Thank you for the helpful insight. Here is what the function looks like working 100% looks like:
RefreshRates(); if(ECNBroker){ if(OrderSignal == OPEN_BUY) { int ticket = OrderSend(Symbol(), OP_BUY, LotsOptimized(), Ask, 3,0, 0, DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD),1), MAGIC,0, Blue); if (ticket > 0) { OrderSelect (ticket, SELECT_BY_TICKET, MODE_TRADES); ErrorCheckOut(OrderModify(ticket,OrderOpenPrice(), OrderOpenPrice() - StopLoss*Point, OrderOpenPrice() + TakeProfit*Point, 0, Blue)); } else ErrorCheckOut(false); // Print("OP_BUY SL = ", NormalizeDouble(Bid , Digits) , " TP = ", NormalizeDouble(Ask + TakeProfit*Point,Digits)); } else if(OrderSignal == OPEN_SELL) { ticket = OrderSend(Symbol(), OP_SELL, LotsOptimized(), Bid, 3,0,0 , DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD),1), MAGIC, 0, Red); if (ticket > 0) { OrderSelect (ticket, SELECT_BY_TICKET, MODE_TRADES); ErrorCheckOut(OrderModify(ticket,OrderOpenPrice(), OrderOpenPrice() + StopLoss*Point, OrderOpenPrice() - TakeProfit*Point, 0, Red)); } else ErrorCheckOut(false); //Print("OP_SEL SL = ", NormalizeDouble(Ask + StopLoss*Point,Digits), " TP = ",NormalizeDouble(Bid - TakeProfit*Point,Digits) ); } } //============================== Non ECN BROKERS ============================ if(!ECNBroker){ if(OrderSignal == OPEN_BUY) { ErrorCheckOut(OrderSend(Symbol(), OP_BUY, LotsOptimized(), Ask, 3, NormalizeDouble(Bid - StopLoss*Point, Digits), NormalizeDouble(Ask + TakeProfit*Point,Digits), DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD),1), MAGIC, 0, Lime)); //Print("OP_BUY SL = ", NormalizeDouble(Bid - StopLoss*Point, Digits) , " TP = ", NormalizeDouble(Ask + TakeProfit*Point,Digits)); } else if(OrderSignal == OPEN_SELL) { ErrorCheckOut(OrderSend(Symbol(), OP_SELL, LotsOptimized(), Bid, 3, NormalizeDouble(Ask + StopLoss*Point,Digits),NormalizeDouble(Bid - TakeProfit*Point,Digits) , DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD),1), MAGIC, 0, DarkOrange)); //Print("OP_SEL SL = ", NormalizeDouble(Ask + StopLoss*Point,Digits), " TP = ",NormalizeDouble(Bid - TakeProfit*Point,Digits) ); } }
investguy: Thank you for the helpful insight. Here is what the function looks like working 100% looks like:
You're Welcome.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
Im Having trouble to figure out what is wrong with my function, could anyone take a look and give any insights... here is the function.
And i get the following error:
2013.03.14 01:15:16 Test EA EURUSD.arm,M12: OP_BUY SL = 1.2946 TP = 1.297
2013.03.14 01:15:16 Test EA EURUSD.arm,M12: LastError = 130 : invalid stops
Thank You in advance.