if(!OrderSelect(i,SELECT_BY_POS)) continue;
if(OrderSymbol()!=Symbol()) continue;
А это как прочитать? Если (Ордер не выбран) продолжить;
Если (Текущий Символ не равен Символу) продолжить; Так? Или как?
My friends, who knows how to implement: EA can get the absolute value of indicator, for example iStohastic(). How can I tell if the indicator has left overbought or oversold zone?
Visually, like a Stochastic indicator with levels 80 and 20.
void STOP_TAKE(void)
{
int SPREAD = (int)MarketInfo(Symbol(),MODE_SPREAD);
if (stoploss<STOPLEVEL) stoploss=0;
if (takeprofit<STOPLEVEL) takeprofit=0;
for(int i=0; i<OrdersTotal(); i++)
{
if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
if(OrderSymbol()!=Symbol()) continue;
int tip = OrderType();
if( tip!=OP_BUY && tip!=OP_BUYSTOP && tip!=OP_BUYLIMIT &&
tip!=OP_SELL && tip!=OP_SELLSTOP && tip!=OP_SELLLIMIT ) continue;
// переменные которые будут использоваться в любых ордерахint Ticket = OrderTicket();
double OOP = OrderOpenPrice(),
OSL = OrderStopLoss(),
OTP = OrderTakeProfit();
//---if( OrderMagicNumber() == Magic )
{ //----------Если Ордера Советникаswitch(tip)
{
caseOP_BUY:
caseOP_BUYSTOP:
caseOP_BUYLIMIT:
{
if (takeprofit!=0) TP = NormalizeDouble(OOP + takeprofit*Point,Digits); else TP=OTP;
if (stoploss!=0) SL = NormalizeDouble(OOP - (stoploss+SPREAD)* Point,Digits); else SL=OSL;
if (OrderModify(Ticket,OOP,SL,TP,0,White)) Print("STOP_TAKE",Ticket," SL ",OSL," -> ",SL," TP ",OTP," -> ",TP);
elsePrint(Symbol()," Error STOP_TAKE",GetLastError()," Ticket ",Ticket);
}
break;
// end casedefault:
{
if (takeprofit!=0) TP = NormalizeDouble(OOP - takeprofit*Point,Digits); else TP=OTP;
if (stoploss!=0) SL = NormalizeDouble(OOP + (stoploss+SPREAD)* Point,Digits); else SL=OSL;
if (OrderModify(Ticket,OOP,SL,TP,0,White)) Print("STOP_TAKE",Ticket," SL ",OSL," -> ",SL," TP ",OTP," -> ",TP);
elsePrint(Symbol()," Error STOP_TAKE",GetLastError()," Ticket ",Ticket);
} // end case
} // end switch
}
else
{ //----------Если Ордера Оператораswitch(tip)
{
caseOP_BUY:
caseOP_BUYSTOP:
caseOP_BUYLIMIT:
{
if (takeprofit!=0) TP = NormalizeDouble(OOP + takeprofit*Point,Digits); else TP=OTP;
if (stoploss!=0) SL = NormalizeDouble(OOP - (stoploss+SPREAD)* Point,Digits); else SL=OSL;
if (OrderModify(Ticket,OOP,SL,TP,0,White)) Print("STOP_TAKE",Ticket," SL ",OSL," -> ",SL," TP ",OTP," -> ",TP);
elsePrint(Symbol()," Error STOP_TAKE",GetLastError()," Ticket ",Ticket);
}
break;
// end casedefault:
{
if (takeprofit!=0) TP = NormalizeDouble(OOP - takeprofit*Point,Digits); else TP=OTP;
if (stoploss!=0) SL = NormalizeDouble(OOP + (stoploss+SPREAD)* Point,Digits); else SL=OSL;
if (OrderModify(Ticket,OOP,SL,TP,0,White)) Print("STOP_TAKE",Ticket," SL ",OSL," -> ",SL," TP ",OTP," -> ",TP);
elsePrint(Symbol()," Error STOP_TAKE",GetLastError()," Ticket ",Ticket);
} // end case
} // end switch
} // end if
} // end for
} // end STOP_TAKE
Although you have exactly the same logic when modifying EA and other orders. Why exactly you need to distinguish them is not quite clear. But I think the principle is useful.
@Konstantin Nikitin It's easier for you! You're an expert! I'm learning!
Rewerpool:
How do you read this? If (Order is not selected) continue;
If (Current Symbol is not equal to Symbol) continue; Right? Or how?
Operator continue
@Konstantin Nikitin Got it, so: Correct me if anything!
And here's another question: !OrderSelect - does it mean: No Order or No Order selected?
Got it, so: Correct me if there's anything!
If no order is selected, the next element of the loop is selected
Operations and expressions and look at logical operations there
added more like this:
Why even write it that way?
If you only put the EA on one symbol, but it will work on all of them? And the magician will see his own!
Completely confused!
My friends, who knows how to implement: EA can get the absolute value of indicator, for example iStohastic(). How can I tell if the indicator has left overbought or oversold zone?
Visually, like a Stochastic indicator with levels 80 and 20.
Rewerpool: Well, there you go, no mistakes.
Although you have exactly the same logic when modifying EA and other orders. Why exactly you need to distinguish them is not quite clear. But I think the principle is useful.