doing to do用法:修改止损、止赢源码

来源:百度文库 编辑:中财网 时间:2024/04/29 10:25:34
int TP = 20;
int SL = 20;

double point = MarketInfo( Symbol(), MODE_POINT );
int stop_level = MarketInfo( Symbol(), MODE_STOPLEVEL );
int digits = MarketInfo( Symbol(), MODE_DIGITS );

int useTP = 0, useSL = 0;

if ( TP <= stop_level ) { useTP = stop_level + 1; }
else { useTP = TP; }

if ( SL <= stop_level ) { useSL = stop_level + 1; }
else { useSL = SL; }

double newTP = NormalizeDouble( Bid - useTP*point, digits ); //for Sell
double newSL = NormalizeDouble( Ask + useSL*point, digits ); //for Sell

//OR

double newTP = NormalizeDouble( Ask + useTP*point, digits ); //for Buy
double newSL = NormalizeDouble( Bid - useSL*point, digits ); //for Buy