Sell Stop level

 

Hi,

I would like to place a sell stop as on picture below:

ZigZag

I have this loop below to find last up and last down ZigZag indicator but I don't want to place a pending order on the first up or down ZigZag, what is wrong into my loop?

   int limit2=1;
   for(int p=1;p<=limit2;p++)
   {
      for(int b=1;b<Bars;b++)
      {
         if(iCustom(NULL,0,"ZigZag",Indic_1,Indic_2,Indic_3,0,b)!=0 && iCustom(NULL,0,"ZigZag",Indic_1,Indic_2,Indic_3,0,b)>Ask)
         {
            LastUpZigZag=iCustom(NULL,0,"ZigZag",Indic_1,Indic_2,Indic_3,0,b);
            LastUpZigZagSignal=1;
            break;
         }
      }
      for(int t=1;t<Bars;t++)
      {
         if(iCustom(NULL,0,"ZigZag",Indic_1,Indic_2,Indic_3,0,t)!=0 && iCustom(NULL,0,"ZigZag",Indic_1,Indic_2,Indic_3,0,t)<Bid)
         {
            LastDownZigZag=iCustom(NULL,0,"ZigZag",Indic_1,Indic_2,Indic_3,0,t);
            LastDownZigZagSignal=1;
            break;
         }
      }
   }         
 

It's easy ...

Just add or substract more pips to/from the variable that calculated those levels.

You may be need to add an external variable like,

input int ExtraPips = 100;

 Don't forget to multiply EtraPips*Point in your calculations ...

 
There is a script for this in the code base section.  It is in a collection of a lot of scripts that can be used.
 

Thank you for your answers.

Osama: it is difficult to know in advance how many extra pips add or substract because there is no precise rule, it changes all the time.

Michael: I don't find this script in the code base section, could you post the url of the page if you find it?