Einzelnen Beitrag anzeigen
  #15 (permalink)  
Alt 06.06.18
MA-EA MA-EA ist offline
Elite Mitglied
 
Registriert seit: Sep 2015
Beiträge: 1.178
MA-EA befindet sich auf einem aufstrebenden Ast
Standard

Lebt hier noch Jemand?

Der SL wird anscheinend richtig berechnet und gesetzt.

Der TP allerdings ist im Backtest und im Demo immer genau wie der Einstiegskurs. Manchmal mit 2 o. 3 Pips Abstand. Aber allgemein ist TP immer gleich Einstiegskurs. Eingestellt ist er auf 150. Hab eben 99 versucht, selbes Problem.

Code:
extern int Stoploss=30;
 extern int Takeprofit=150;
Code:
double M_CA=NormalizeDouble(MarketInfo(Symbol(),MODE_ASK),_Digits);


 double M_CB=NormalizeDouble(MarketInfo(Symbol(),MODE_BID),_Digits);
Code:
//Normaler SL
 if(Stoploss>0&&Auto_Stoploss==false)double B_SL=NormalizeDouble(M_CA-Stoploss*_Point,_Digits);//einfacher Buy SL, der bei Open Buy gesendet werden soll.
 if(Stoploss>0&&Auto_Stoploss==false)double S_SL=NormalizeDouble(M_CB+Stoploss*_Point,_Digits);//einfacher Sell SL, der bei Open Sell gesendet werden soll.

 //Normaler TP
if(Takeprofit>0&&Auto_Takeprofit==false)double B_TP=NormalizeDouble(M_CA+Takeprofit*_Point,_Digits);//einfacher Buy TP, der bei Open Buy gesendet werden soll.
 if(Takeprofit>0&&Auto_Takeprofit==false)double S_TP=NormalizeDouble(M_CB-Takeprofit*_Point,_Digits);//einfacher Sell TP, der bei Open Sell gesendet werden soll.
Code:
if(!IsInv&&SPR_AL==true&&RT==true){
OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,B_SL,B_TP,Name + " Buy(#" + Buy_MagicNumber + ")",Buy_MagicNumber,0,Blue);
OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,S_SL,S_TP,Name + " Sell(#" + Sell_MagicNumber + ")",Sell_MagicNumber,0,Red);}
Angehängte Dateien
Dateityp: mq4 Valerius_MT4_AutoSL_TS_AutoTP_LoSh_EA.mq4 (29,3 KB, 5x aufgerufen)