iHigh Problem

 

Iam trying to adjust a trailing stop depending on the highest price in the past 90 periods.. and

have tried this code, but am not getting a result. Can anyone point me in the right direction..

.......... thanks

...........Krakatoa

double Trailer = iHigh(NULL, 0, iHighest(NULL,0,MODE_HIGH,90,1))*0.005;

OrderSelect(TicketA,SELECT_BY_TICKET,MODE_TRADES);

if ((High[1]+(Trailer*Point))>OrderStopLoss())return;
T=OrderModify(OrderTicket(), OrderOpenPrice(), (High[1]+(Trailer*Point)), OrderTakeProfit(), OrderExpiration(), Blue);
if (T==true ) ..........

 
I don't understand why you write return after:
if ((High[1]+(Trailer*Point))>OrderStopLoss())
And why don't use standard trailing stop?
 
MikTrade wrote >>
I don't understand why you write return after: And why don't use standard trailing stop?

Hi MikTrade,

The return part is so the trailStop only moves down (this is on a short trade), I don't want the Stop moving up

if the price starts increasing.

I am trying to get a stop(Trailer value) that is a set 1/2 % of the price 90 periods ago.. i.e if the high 90 ago was .8000

then the Trail value would be .004... then if the price starts increasing and it was 1.0000 90 periods ago the Trailer value would be

.005..

Is this possible?? and what am I doing wrong in my code?

Thanks

......Krakatoa