|
Programmierung MQL4 Hier gehts rund ums Programmieren in MQL4. |
|
Themen-Optionen | Thema durchsuchen | Ansicht |
|
|||
TrailingStop für guten EA
Hi!
Kann mir jemand einen TrailingStop in diesen EA basteln? Wäre super! jiva34's MA cross Fractals combo auto trading robot by Steve Hopwood.mq4 Greetz.. |
|
|||
hi
anbei der code für einen TrailingStop der erst ab einem gewissen TP den stop nachzieht vl ist das das was du suchtst falls nicht müsstest du mal dazusagen wie der stop gesetzt werden soll LG (der Code ist nicht von mir sonder aus einem anderen EA) Code:
void TrailingAlls(int start,int stop, double AvgPrice) { int profit; double stoptrade; double stopcal; if(stop==0) return; int trade; for(trade=OrdersTotal()-1;trade>=0;trade--) { if(!OrderSelect(trade,SELECT_BY_POS,MODE_TRADES)) continue; if(OrderSymbol()!=Symbol()||OrderMagicNumber()!=MagicNumber) continue; if(OrderSymbol()==Symbol()||OrderMagicNumber()==MagicNumber) { if(OrderType()==OP_BUY) { profit=NormalizeDouble((Bid-AvgPrice)/Point,0); if(profit<start) continue; stoptrade=OrderStopLoss(); stopcal=Bid-(stop*Point); if(stoptrade==0||(stoptrade!=0&&stopcal>stoptrade)) // OrderModify(OrderTicket(),OrderOpenPrice(),stopcal,OrderTakeProfit(),0,Blue); OrderModify(OrderTicket(),AvgPrice,stopcal,OrderTakeProfit(),0,Aqua); }//Long if(OrderType()==OP_SELL) { profit=NormalizeDouble((AvgPrice-Ask)/Point,0); if(profit<start) continue; stoptrade=OrderStopLoss(); stopcal=Ask+(stop*Point); if(stoptrade==0||(stoptrade!=0&&stopcal<stoptrade)) // OrderModify(OrderTicket(),OrderOpenPrice(),stopcal,OrderTakeProfit(),0,Red); OrderModify(OrderTicket(),AvgPrice,stopcal,OrderTakeProfit(),0,Red); }//Shrt } Sleep(1000); }//for } |
|
|||
Function "TrailingAlls" is not referenced and will be removed
Vielen Dank für die Hilfe.
Beim compile kommt aber die Meldung: Function "TrailingAlls" is not referenced and will be removed from exp-file Habe was falsch gemacht? greetz.. |
Lesezeichen |
Stichworte |
trailing stop, trailingstop, trailingstop einbauen, trailingstop in guten ea basteln, ts einbauen |
|
|