Hallo
Wie ihr wisst bin ich neu hier .
Ich habe versucht einen Halb automatischen ea zu schreiben (nicht lachen bin ja voller Anfänger)
.
funktioniert soweit auch . Ziel ist es den Stop nach zu ziehen (SMA).
Er hat aber noch Fehler :
er zieht nicht immer nach
er schliesst obwohl er nicht ins sl läuft
wer Lust und Laune hat könnte mir bitte helfen .Würde mich sehr freuen über jede Hilfe und Verbesserung .
Danke
-------------------------------------------------------
#property strict
input int Magic = 1 ;
int OnInit() {
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason){
}
void OnTick() {
double ma = iMA (_Symbol,PERIOD_CURRENT,9,0,MODE_SMA,PRICE_CLOSE,0 );
for(int i = OrdersTotal()-1; i >= 0; i--){
if(OrderSelect(i,SELECT_BY_POS)){
if(OrderSymbol() ==_Symbol) {
if (OrderType()== OP_BUY){
double sl = ma;
sl = NormalizeDouble(sl,_Digits);
if(sl > OrderStopLoss()){
if(OrderModify(OrderTicket(),OrderOpenPrice(),sl,O rderTakeProfit(),OrderExpiration())){
Print(__FUNCTION__," > Order #",OrderTicket()," wurde angepasst ...");
}
}
}else if(OrderType() == OP_SELL){
double sl = ma;
sl = NormalizeDouble(sl,_Digits);
if(sl > OrderStopLoss()){
if(OrderModify(OrderTicket(),OrderOpenPrice(),sl,O rderTakeProfit(),OrderExpiration())){
Print(__FUNCTION__," > Order #",OrderTicket()," wurde angepasst ...");
}
}
}
}
}
}
}