Thema: Stoploss
Einzelnen Beitrag anzeigen
  #26 (permalink)  
Alt 18.07.17
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

Mit SL 150 scheints zu gehn.

Mein Versuch eines Trailing-Stops. Ist der Sch... so zu gebrauchen? Oder überhaupt richtig?
Code:
//Globale Variablen
//Sicherheitsausstieg
extern double Stoploss=150.0;
extern string TS="true=Yes / false=No";
extern bool Use_Trailing_Stop=true;
extern double Takeprofit=0.0;
Code:
//SL TP Deklas
double minstoplevel=MarketInfo(Symbol(),MODE_STOPLEVEL);
double openPrice=NormalizeDouble(MarketInfo(Symbol(),MODE_ASK),_Digits);
double buy_SL=NormalizeDouble(openPrice-Stoploss*_Point,_Digits);
double buy_TP=NormalizeDouble(openPrice+Takeprofit*_Point,_Digits);
double sell_SL=NormalizeDouble(openPrice+Stoploss*_Point,_Digits);
double sell_TP=NormalizeDouble(openPrice-Takeprofit*_Point,_Digits);
//-------------------------------------------------------------------------------------------------------------

//Trailing Stop
if(Use_Trailing_Stop==true){
  if(Ask>buy_SL)buy_SL=NormalizeDouble(openPrice-Stoploss*_Point,_Digits);
  if(Ask<sell_SL)sell_SL=NormalizeDouble(openPrice+Stoploss*_Point,_Digits);}