近日在使用PrintFormat()函数,照F1 help依葫芦画瓢,死活不能正常显示,如下代码,
double margin_call = AccountInfoDouble(ACCOUNT_MARGIN_SO_CALL); double stop_out = AccountInfoDouble(ACCOUNT_MARGIN_SO_SO);
string sp = "-------------";
//PrintFormat(sp,"MarginCall= %f, StopOut= %f",AccountInfoDouble(ACCOUNT_MARGIN_SO_CALL),stop_out); //显示不正常
//Print(sp,"---MarginCall= ",DoubleToStr(margin_call,2),unit); //DoubleToStr(margin_call,2),
//Print(sp,"---StopOut= ",DoubleToStr(stop_out,2),unit); //,DoubleToStr(stop_out,2)
PrintFormat("%s---MarginCall= %G%s, StopOut= %G%s",sp,margin_call,unit,stop_out,unit);
最后经大神(QQ10366684)指点,最后一句才能正常显示,理由是不能提前使用变量(如变量sp)!
发表评论