Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

derek2209

Sliding Range

Recommended Posts

Hello,

 

Would anyone be kind enough the convert the mq4 formula for the

Sling Range into Tradestation Code

Hoping that you can oblige

Thank you in advance

Derek

 

//+------------------------------------------------------------------+
//|                                              Rj_SlidingRange.mq4 |
//|                            Copyright © 2011,RJ Rjabkov Alexander |
//|                                                     rj-a@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011,RJ Rjabkov Alexander"
#property link      "rj-a@mail.ru"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Aqua
#property indicator_color2 Red
#property indicator_color3 Aqua
#property indicator_color4 Red
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 2
#property indicator_width4 2
#property indicator_style1 2
#property indicator_style2 2

extern int CalcPeriodRange  = 5;

double UpperLimit[];
double LowerLimit[];
double AwlUpper[];
double AwlLower[];
double Current[];

int init() {
 IndicatorBuffers(5);
 SetIndexBuffer(0, UpperLimit);
 SetIndexBuffer(1, LowerLimit);
 SetIndexBuffer(2, AwlUpper);
 SetIndexBuffer(3, AwlLower);
 SetIndexBuffer(4, Current);
 SetIndexStyle(0, DRAW_LINE);
 SetIndexStyle(1, DRAW_LINE);
 SetIndexStyle(2, DRAW_LINE);
 SetIndexStyle(3, DRAW_LINE);
 return(0);
}

int deinit() {return(0);}

int start() {
 int i, cb;
 int counted_bars = IndicatorCounted();
 if (counted_bars < 0) return(-1); 
 if (counted_bars > 0) counted_bars--;
 cb=Bars-counted_bars;

 while(cb>=0) {
   i=cb+CalcPeriodRange-1;
   double b1=0, b2=0;
   while(i>=cb) {
     b1 += High[iHighest(NULL, 0, MODE_HIGH, CalcPeriodRange, i)];
     b2 += Low[iLowest(NULL, 0, MODE_LOW, CalcPeriodRange, i)];
     i--;
   }
   UpperLimit[cb]=b1/CalcPeriodRange;
   LowerLimit[cb]=b2/CalcPeriodRange;
   Current[cb]=NormalizeDouble((UpperLimit[cb]+LowerLimit[cb])/2, 5);
   AwlUpper[cb]=EMPTY_VALUE;
   AwlLower[cb]=EMPTY_VALUE;
   if(Current[cb]>Current[cb+1]) {AwlUpper[cb]=Current[cb]; AwlUpper[cb+1]=Current[cb+1];}
   if(Current[cb]<Current[cb+1]) {AwlLower[cb]=Current[cb]; AwlLower[cb+1]=Current[cb+1];}
   if(Current[cb]==Current[cb+1] && AwlLower[cb+1]!=EMPTY_VALUE) {AwlLower[cb]=Current[cb];}
   if(Current[cb]==Current[cb+1] && AwlUpper[cb+1]!=EMPTY_VALUE) {AwlUpper[cb]=Current[cb];}
   cb--;
 }
 return(0);
}
//+------------------------------------------------------------------+

Share this post


Link to post
Share on other sites

Hi

 


Inputs:
Period(5);

vars:
MidLine(0),UpperBand(0),LowerBand(0);

UpperBand=Average(Highest(High,Period),Period);
LowerBand=Average(Lowest(Low,Period),Period);
MidLine=(UpperBand+LowerBand)/2;

Plot1(MidLine,"MidLine");
if MidLine >= MidLine[1] then setplotcolor(1,Cyan) else setplotcolor(1,red);

Plot2(UpperBand,"UpperBand",LightGray);
Plot3(LowerBand,"LowerBand",DarkGray);

 

Derek

Share this post


Link to post
Share on other sites
Look and works like junk tried on my Hotforex platform and once again got a proof that there is no better than simple but effective price action.

 

Some end of year thoughts on trading using priceseries *

 

Consciously, ‘PAv’ traders are categorically NOT able to trade with oscillators (/ indicators). (Note that ‘consciously’ part - because unconsciously every single one of them is creating and using ‘indicators’ in the background.)

 

Real oscillators traders can categorically NOT (consciously) trade with PA. (Note that ‘consciously’ part - because unconsciously every single one of them is attempting to process PA on the fly.)

 

Point is - Both modes are always going / functioning.

 

“Find your own way” zdo. Find out which one you are best suited for, make that one dominant and develop it that fully... Let the other one be recessive.

 

If you’re a PA trader, don’t fool yourself into total rejection of oscillators. And by the same token, if you’re an oscillators trader, don’t be swayed by the preaching of PA traders to completely exclude oscillators trading. Find out which one you are best suited for, develop that fully... and then you might be free to consciously include and accommodate certain aspects from the other one.

 

...

 

PA traders do notice and repeatedly announce an important ‘weakness’ of indicators. Stock indicators don’t ‘work’. :rofl:

Yep, statistically out the box at best they produce ( with ‘costs, a slightly negative) wash... ie the ‘sample runs’ where they outperform do not offset the ‘sample runs’ where they underperform, etc. **

...

 

The key word here is “stock”.

 

There are (only?) three ways to overcome this weakness of stock indicators.

1 ‘Skew’ the indicator calculations to match the ‘slope’ (and travel, etc) of the auctions.

2 Learn to ‘wetware skew’ the reading of the indicator to match the ‘slope’ (etc) of the auctions.

3 Type the auctions to know when and when NOT to apply an indicator

 

ie You got to know when and how to "harm squiggly lines" (sorry TRO for appropriating your apt phrase... :) )

 

 

Wishing all ya'll wonderful holidays and a happy solstice in exactly one minute !!!!

 

 

zdo

 

 

 

*instead of non price / fundamental / narrative information

 

**:haha: Unfortunately, PA traders can't go about as readily acknowledging the equivalent real world statistics of 'out the box' PA... ie don't get it that both modes are always going / functioning.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Topics

  • Posts

    • $DXCM (DXCM) DexCom stock top of range breakout watch above 75.61,



      analysis http://chart.st/DXCM
       
    • Date : 24th April 2018.

      MACRO EVENTS & NEWS OF 24th April 2018.



      FX News Today

      European Outlook: Asian markets moved mostly higher overnight, following on from a positive session on Wall Street and amid ongoing USD strength with a weaker Yen underpinning a 0.75% rise in the Nikkei. The Hang Seng is up 0.94%, the CSI 300 rallied 1.75% amid speculation that the government is considering easing some policies put in to limit the credit boom. The absence of any negative news on the trade front seems to have given stock markets some breathing space and U.S. futures are also up in tandem with U.K. futures. Oil prices are also up and the front end Nymex future is trading at USD 69.14 per barrel. For now though bonds are getting a boost and stock markets are also higher, with most European futures posting gains in tandem with U.S. futures and after a positive session in Asia. Today’s calendar focuses on confidence data out of France, Germany and the U.K.. The U.K. also has public finance data and Germany auctions 2-year Schatz notes.

      FX Update: The dollar posted fresh highs against the euro and yen, and many other currencies after a bout of demand in Asia, which extending a broad rally the greenback has been seeing against for over a week now. The narrow trade-weighted USD index (DXY) posted its highest level since the first week of January, at 91.07. EURUSD logged a 10-week low at 1.2184, though euro demand has subsequently fuelled a rebound to the 1.2220 area. USDJPY lifted for a sixth consecutive session, making a 10-week high at 108.87. EURJPY is also firmer, though has so far remained below the two-month high it saw last week. The gains in USDJPY have been concomitant with the U.S. T-note yield nearing the 3.0% level, which has been generating headlines, which comes with the BoJ continuing to peg JGB 10-year yields near 0.0%. The Nikkei 225 closed 0.86% for the better, more than reversing the moderate loss seen yesterday. North Korea’s Kim said that he would be willing to accept IAEA inspections of nuclear facilities.

      Charts of the Day



      Main Macro Events Today
        German IFO – The German Ifo business confidence indicator, due Tuesday, comes in a new format this month, which includes the services sector now. For the new indicator a dip is expected to 102.8 from 103.2, and a decline in the expectations reading to 99.5 from 100.1 in the previous month. However, after the better than expected PMI readings there is a bias to the upside to the numbers. In any case, we don’t expect the April round of survey indicators to really change the outlook for the ECB, which is seen on hold this week, with officials seeing scope to leave the final decision on the future of the QE program open until July, when the risks to the global outlook may have become a bit clearer and the decision is becoming urgent. UK Public Borrowing – Expectations – at 1.6B pounds from -0.272B pounds last month. US Consumer confidence – likely declined to 126.0 in April, from March’s 127.7. US New home sales – expected to rise to 0.630 mln in April from 0.618 mln in February. Support & Resistance Levels



      Always trade with strict risk management. Your capital is the single most important aspect of your trading business.

      Please note that times displayed based on local time zone and are from time of writing this report.

      Click HERE to access the full HotForex Economic calendar.

      Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding on how markets work. Click HERE to register for FREE!

      Click HERE to READ more Market news. 


      Andria Pichidi
      Market Analyst
      HotForex


      Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in FX and CFDs products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
    • Addendum:
      http://www.thedailybell.com/news-analysis/if-you-limit-any-free-speech-this-is-what-you-get/  
      ...
      Anar  Chicagoans, etc, etc, -  wake up !
      This -> https://www.mintpressnews.com/cheran-mexicos-indigenous-community-that-rebelled-against-narcos-thieves-and-politicians-and-won/240979/
      instead of this -> http://massprivatei.blogspot.com/2018/04/smart-city-projects-are-really-police.html
       
    • $WD (WD) Walker & Dunlop stock nice bull flag breakout watch,



      analysis http://chart.st/WD
       
    • $BOFI (BOFI) stock narrow range breakout watch above 42.54,



      analysis http://chart.st/BOFI
       
×

Important Information

By using this site, you agree to our Terms of Use.