MQL4 - automated forex trading   /  

Forum

iHigh Problem

Back to topics list To post a new topic, please log in or register

avatar
2
Krakatoa 2008.06.28 19:39 

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 ) ..........

article

Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Cont.)

In this article the author continues to analyze implementation algorithms of simplest trading systems and describes some relevant details of using optimization results. The article will be useful for beginning traders and EA writers.


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

avatar
2
Krakatoa 2008.06.29 14:38 
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

Back to topics list  

To add comments, please log in or register