Hallo.
Seit etlichen Stunden versuche ich einen Trailing Stop hin zu bekommen. Er soll alle 7 Pips den SL hinter ASK/BID herziehen. Einfacher SL und TP funktionieren einwandfrei.
Ich hab alles Mögliche probiert und gedreht und studiert und getestet und mir das Hirn zerbrochen. Aber er wird einfach nicht hinter her gezogen. Fehlermeldungen oder sowas kommen auch nicht.
Code:
extern string TS="Trailing Stop";
extern bool Trailing_Stop=true;//
extern int Trailing_Stop_Step=7;//Bei ActivTrades müssen SL/TP anscheinend mindestens 5 sein
Code:
double M_CA=MarketInfo(Symbol(),MODE_ASK);
double M_CB=MarketInfo(Symbol(),MODE_BID);
Code:
if(Trailing_Stop==true){
double M_CB_SL_TSS=NormalizeDouble(M_CB-Stoploss-Trailing_Stop_Step*_Point,_Digits);//M_CA = Mode Current Ask
double M_CA_SL_TSS=NormalizeDouble(M_CA+Stoploss+Trailing_Stop_Step*_Point,_Digits);//M_CB = Mode Current Bid
double B_TS=NormalizeDouble(M_CB-Stoploss*_Point,_Digits);
double S_TS=NormalizeDouble(M_CA+Stoploss*_Point,_Digits);
}
Code:
//Modify Orders (Trailing Stop nach ziehen)
if(Trailing_Stop==true){
for(i=OrdersTotal()-1;i>=0;i--){
if(OrderSelect(i,SELECT_BY_TICKET)){
if(OrderType()==OP_BUY&&OrderMagicNumber()==Buy_MagicNumber&&OrderSymbol()==Symbol()){//modify Buy
if(OrderStopLoss()<M_CB_SL_TSS)OrderModify(OrderTicket(),OrderOpenPrice(),B_TS,OrderTakeProfit(),0,LawnGreen);}// ?
if(OrderType()==OP_SELL&&OrderMagicNumber()==Sell_MagicNumber&&OrderSymbol()==Symbol()){//modify Sell
if(OrderStopLoss()>M_CA_SL_TSS)OrderModify(OrderTicket(),OrderOpenPrice(),S_TS,OrderTakeProfit(),0,Gold);}}}}// ?