So I started live testing a system that I have been working on (See attached Results up 10%+ in the first 6 hours, Its a scalper system so it will always carry a floating drawdown) I am having a problem with the Order Modify function ... Can anyone here identify what I have done wrong ? It is suppose to modify the SL when a position reaches 4 pips in profit to lock in 1 pip with a stoploss. but it doesent seem to be doing anything at all. Here is the code
Its gotta be something simple... it always is.
PHP Code
void ManageOrders(){ int cnt; //for(cnt = 0; cnt < OrdersTotal(); cnt++){ for(cnt=OrdersTotal();cnt>0;cnt--){ OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_BUY ){ if(MarketInfo(OrderSymbol(),MODE_BID) >= OrderOpenPrice() + 4 * MarketInfo(OrderSymbol(),MODE_POINT)){ if(OrderStopLoss() < MarketInfo(OrderSymbol(),MODE_BID) - 3 * MarketInfo(OrderSymbol(),MODE_POINT)){ OrderModify(OrderTicket(), OrderOpenPrice(), MarketInfo(OrderSymbol(),MODE_BID) - 3 * MarketInfo(OrderSymbol(),MODE_POINT), OrderTakeProfit(), 0, Orange); } } } continue; if (OrderType() == OP_SELL ){ if(MarketInfo(OrderSymbol(),MODE_ASK) <= OrderOpenPrice() - 4 * MarketInfo(OrderSymbol(),MODE_POINT)){ if(OrderStopLoss() > MarketInfo(OrderSymbol(),MODE_ASK) + 3 * MarketInfo(OrderSymbol(),MODE_POINT)){ OrderModify(OrderTicket(), OrderOpenPrice(), MarketInfo(OrderSymbol(),MODE_ASK) + 3 * MarketInfo(OrderSymbol(),MODE_POINT), OrderTakeProfit(), 0, Orange); } } } continue; } }
Keep it simple stoopid....