Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SafeZone

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    SafeZone

    Hi,

    does anybody know if the Elder SafeZone indicator is available in NT, or downloadable somewhere in the Internet?


    If not, I will program the indicator in NT and share here in the following weeks.

    #2
    I am unaware of this indicator being provided already. Thank you for offering the contribution though!
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Barabba,
      Did you program it yet? I'm browsing the web for it and can't find.
      Thanks

      Comment


        #4
        Originally posted by drdelco View Post
        Barabba,
        Did you program it yet? I'm browsing the web for it and can't find.
        Thanks
        Here is the code in mq4. Sorry, I haven't gotten the hang of NT yet.


        //+------------------------------------------------------------------+
        //| Elders Safe Zone.mq4 |
        //| Cubesteak |
        //| www.cubesteak.net |
        //+------------------------------------------------------------------+
        #property copyright "Cubesteak"
        #property link "www.cubesteak.net"
        //----
        #property indicator_buffers 1
        #property indicator_color1 Red
        #property indicator_chart_window
        //----
        extern int LookBack=10;
        extern int StopFactor=2;
        extern int EMALength=21;
        extern color LineColor=Crimson;
        //----
        double ExtBuffer[];
        //+------------------------------------------------------------------+
        //| Custom indicator initialization function |
        //+------------------------------------------------------------------+
        int init()
        {
        //---- indicators
        SetIndexBuffer(0,ExtBuffer);
        SetIndexStyle(0,DRAW_LINE,2,1,LineColor);
        //----
        return(0);
        }
        //+------------------------------------------------------------------+
        //| Custom indicator deinitialization function |
        //+------------------------------------------------------------------+
        int deinit()
        {
        //----
        //----
        return(0);
        }
        //+------------------------------------------------------------------+
        //| Custom indicator iteration function |
        //+------------------------------------------------------------------+
        int start()
        {
        double SafeStop=0;
        int counted_bars=IndicatorCounted();
        int limit=Bars - LookBack - 3;
        for(int shift=limit;shift>=0;shift--)
        {
        double EMA0=iMA(Symbol(),0,EMALength,0,MODE_EMA,0,shift);
        double EMA1=iMA(Symbol(),0,EMALength,0,MODE_EMA,0,shift+1 );
        double EMA2=iMA(Symbol(),0,EMALength,0,MODE_EMA,0,shift+2 );
        double PreSafeStop=ExtBuffer[shift+1];
        double Pen=0;
        int Counter=0;
        if (EMA0 > EMA1)
        {
        for(int value1=0;value1<=LookBack; value1++)
        {
        if (Low[shift+value1] < Low[shift+value1+1])
        {
        Pen=Low[shift+value1+1] - Low[shift+value1] + Pen;
        Counter=Counter + 1;
        }
        }
        if (Counter!=0) SafeStop=Close[shift] - (StopFactor * (Pen/Counter));
        else SafeStop=Close[shift] - (StopFactor * Pen);
        if ((SafeStop < PreSafeStop) && (EMA1 > EMA2)) SafeStop=PreSafeStop;
        }
        if (EMA0 < EMA1)
        {
        for(value1=0;value1<=LookBack; value1++)
        {
        if (High[shift+value1] > High[shift+value1+1])
        {
        Pen=High[shift+value1] - High[shift+value1+1] + Pen;
        Counter=Counter + 1;
        }
        }
        if (Counter!=0) SafeStop=Close[shift] + (StopFactor * (Pen/Counter));
        else SafeStop=Close[shift] + (StopFactor * Pen);
        if ((SafeStop > PreSafeStop) && (EMA1 < EMA2)) SafeStop=PreSafeStop;
        }
        PreSafeStop=SafeStop;
        ExtBuffer[shift]=SafeStop;
        }
        //----
        //----
        return(0);
        }
        //+------------------------------------------------------------------+



        Here it is in MetaStock. I have stripped out the information headers to save space but the author is Jose Silva.

        { User inputs }
        coefficient:=2;
        bkpds:=10;
        pds:=21;
        adv:=1;
        type:=1;
        plot:=1;
        { Downside penetrations }
        DwSidePen:=
        If(type=1,Mov(C,pds,E)>Ref(Mov(C,pds,E),-1),1)
        AND L<Ref(L,-1);
        DwSideDiff:=If(DwSidePen,Ref(L,-1)-L,0);
        DwPenAvg:=Sum(DwSideDiff,bkpds)
        /Max(Sum(DwSidePen,bkpds),.000001);
        StLong:=Ref(L-DwPenAvg*coefficient,-1);
        StopLong:=If(C<PREV,StLong,Max(StLong,PREV));
        { Upside penetrations }
        UpSidePen:=
        If(type=1,Mov(C,pds,E)<Ref(Mov(C,pds,E),-1),1)
        AND H>Ref(H,-1);
        UpSideDiff:=If(UpSidePen,H-Ref(H,-1),0);
        UpPenAvg:=Sum(UpSideDiff,bkpds)
        /Max(Sum(UpSidePen,bkpds),.000001);
        StShort:=Ref(H+UpPenAvg*coefficient,-1);
        StopShort:=If(C>PREV,StShort,Min(StShort,PREV));
        { Stop signals }
        entry:=Cross(Typical(),Ref(StopShort,-1));
        exit:=Cross(Ref(StopLong,-1),Typical());
        { Clean signals }
        Init:=Cum(IsDefined(entry+exit))=1;
        bin:=ValueWhen(1,entry-exit<>0 OR Init,
        entry-exit);
        entry:=bin=1 AND (Alert(bin<>1,2) OR Init);
        exit:=bin=-1 AND (Alert(bin<>-1,2) OR Init);

        Comment


          #5
          Thanks for sharing lasater529! Hopefully somebody helps you convert it, for our custom indicator coding tutorials please follow this link - http://www.ninjatrader-support.com/H...verview18.html
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Hello,

            Is there SaveZone already avaible for Ninjatrader? I am still trying to find it. However, I wasn't successful so far. Please let me know as soon as it's avaible.

            Comment


              #7
              Please check the file sharing section for what is publicly shared. If it is not there then you could try one of these 3rd party NinjaScript consultants to program what you are looking for: http://www.ninjatrader.com/webnew/pa...injaScript.htm
              Josh P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by pvincent, 06-23-2022, 12:53 PM
              14 responses
              238 views
              0 likes
              Last Post Nyman
              by Nyman
               
              Started by TraderG23, 12-08-2023, 07:56 AM
              9 responses
              382 views
              1 like
              Last Post Gavini
              by Gavini
               
              Started by oviejo, Today, 12:28 AM
              0 responses
              1 view
              0 likes
              Last Post oviejo
              by oviejo
               
              Started by pechtri, 06-22-2023, 02:31 AM
              10 responses
              125 views
              0 likes
              Last Post Leeroy_Jenkins  
              Started by judysamnt7, 03-13-2023, 09:11 AM
              4 responses
              59 views
              0 likes
              Last Post DynamicTest  
              Working...
              X