Auf "Like" klicken.
extern string TS="Trailing Stop";
extern bool Trailing_Stop=true;
extern int Trailing_Stop_Step=7;
extern string ATSS1="if SL <=";
extern string ATSS2="Trailing_Stop_Step";
extern string ATSS3="TSS = Alternative_";
extern string ATSS4="Trailing_Stop_Step";
extern int Alt_TSS=1;
if(Trailing_Stop==true){
for(i=OrdersTotal()-1;i>=0;i--){
if(OrderSelect(i,SELECT_BY_POS)){
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(OrderType()==OP_BUY&&OrderMagicNumber()==Buy_Ma gicNumber&&OrderSymbol()==Symbol()){
double B_OOP=OrderOpenPrice();
double B_OSL=OrderStopLoss();
double B_OOP_B_OSL=B_OOP-B_OSL;
double B_TS=M_CB-B_OOP_B_OSL;
if(NormalizeDouble(B_OOP_B_OSL<=Trailing_Stop_Step *_Point,_Digits))Trailing_Stop_Step=Alt_TSS;
double B_TS_TSS=NormalizeDouble(B_TS-Trailing_Stop_Step*_Point,_Digits);
if(B_OSL<B_TS_TSS){
OrderModify(OrderTicket(),OrderOpenPrice(),B_TS,Or derTakeProfit(),0,LightBlue);}}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(OrderType()==OP_SELL&&OrderMagicNumber()==Sell_ MagicNumber&&OrderSymbol()==Symbol()){
double S_OSL=OrderStopLoss();
double S_OOP=OrderOpenPrice();
double S_OSL_S_OOP=S_OSL-S_OOP;
if(NormalizeDouble(S_OSL_S_OOP<=Trailing_Stop_Step *_Point,_Digits))Trailing_Stop_Step=Alt_TSS;
double S_TS=M_CA+S_OSL_S_OOP;
double S_TS_TSS=NormalizeDouble(S_TS+Trailing_Stop_Step*_ Point,_Digits);
if(S_OSL>S_TS_TSS){
OrderModify(OrderTicket(),OrderOpenPrice(),S_TS,Or derTakeProfit(),0,Maroon);}}}}}
|