
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
I have deleted your new topic.
If you can't resolve your problems here, starting a new topic will not bring any different results.
Okay Keith, I posted my code for whroeder1 but he didn't respond. Could you possibly help me?
//EXECUTE SELL CONDITION
//************************************************************
{
if( sell_condition_1 && sell_condition_2 && sell_condition_3 && sell_condition_4 && sell_condition_5 && sell_condition_6 && sell_condition_7)
{
double ShortStopLoss = Bid + (StopLoss * Point*10);
double ShortTakeProfit = Bid - (TakeProfit * Point*10);
//-------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------
ShortTicket = OrderSend(Symbol(),OP_SELL,LotSize,Bid,0,ShortStopLoss,ShortTakeProfit,"Sell Order",MagicNumber,0,Red);
//-------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------
double ShortOpen = OrderOpenPrice();
for(int S = OrdersTotal()-1; S >= 0; S--)
OrderSelect(S,SELECT_BY_POS, MODE_TRADES);
{
if((ShortOpen-Ask)>TrailingStop*Point*10)
{
int res=OrderModify(OrderTicket(),OrderOpenPrice(),(Ask+(Point*(TrailingStop)*10)),OrderTakeProfit(),0,Blue);
if(!res)
Print("Error in OrderModify. Error code=",GetLastError());
else
Print("Order modified successfully.");
}
}
Your formatting is a total mess. What are you trying to do, make it pretty or something?
IF you remove all that crap and format it sensibly
if(sell_condition_1 && sell_condition_2 && sell_condition_3 && sell_condition_4 && sell_condition_5 && sell_condition_6 && sell_condition_7)
{
double ShortStopLoss=Bid+(StopLoss*Point*10);
double ShortTakeProfit=Bid -(TakeProfit*Point*10);
ShortTicket=OrderSend(Symbol(),OP_SELL,LotSize,Bid,0,ShortStopLoss,ShortTakeProfit,"Sell Order",MagicNumber,0,Red);
double ShortOpen=OrderOpenPrice();
for(int S=OrdersTotal()-1; S>=0; S--)
OrderSelect(S,SELECT_BY_POS,MODE_TRADES);
{
if((ShortOpen-Ask)>TrailingStop*Point*10)
{
int res=OrderModify(OrderTicket(),OrderOpenPrice(),(Ask+(Point*(TrailingStop)*10)),OrderTakeProfit(),0,Blue);
if(!res)
Print("Error in OrderModify. Error code=",GetLastError());
else
Print("Order modified successfully.");
}
}
you find exactly as WHRoeder has already told you.
The whole block of code is reliant on the very first if, so the break even will only be checked immediatley after the order is opened.