Dear Support


I would like to write a trailing stop formula, that in some ocassion the type 
of the stop have to change.




example:
 

for( i = 2 ; i < BarCount; i++ )
{
  if (High[i]>bekapcs_L[i] AND bekapcs_L[i]>0)
    {
       alap_stop[i]=2;
    }
       else
    {
        if (bekapcs_L[i]>0 AND alap_stop[i-1]>0)
        {
           alap_stop[i]=alap_stop[i-1];
        }
        else
        {
           alap_stop[i]=0;

            }

    }
}



version1
**********************************************************************
for( i = 2 ; i < BarCount; i++ )
{
    if (i == BarCount-1 AND alap_stop[i]>0)
    {
        ApplyStop(2,Sstopmode,(TickSize)*(10+spread_x/2),True );
    }
    else
    {
        ApplyStop(0,Sstopmode,(TickSize)*(10+spread_x/2),True );
    }
}
**********************************************************************



********* or *****************

version2
**********************************************************************

        
ApplyStop(iif(alap_stop==2,2,0),Sstopmode,(TickSize)*(10+spread_x/2),True );

**********************************************************************


I tried the previous two formula, but they don't works.


So i need a formula wherewith:
if the prices moves x point, the stoptypeloss must be change to stoptypetrail.


Could you give me some advice about my problem?


Best regards
Gabor Vidovics

Reply via email to