這個函數做出來的效果如下圖:
函數名稱: _ShowStrategy
函數程式碼:
{Show StrategyName on Chart...start}
text_delete(value1);
value1=TEXT_New(D, T, H,"");
if marketposition>0 then TEXT_SetString(value1, getstrategyname + "=Strong_" + NumToStr(entryprice,0));
if marketposition<0 then TEXT_SetString(value1, getstrategyname + "=Weak_" + NumToStr(entryprice,0));
if marketposition=0 then TEXT_SetString(value1, getstrategyname + "=even");
TEXT_SetStyle(value1, 1, 1);
TEXT_SetColor(value1, Red);
TEXT_SetBGcolor(value1, White);
TEXT_Setattribute(value1,1,true);
TEXT_SetSize(value1,11);
TEXT_Setlocation(value1,D,T,GetAppInfo(aiHighestDispValue));
{Show StrategyName on Chart...end}
函數建立好之後,如何放在你的策略訊號程式碼內呢?
例如:
if Average( C, 5 ) > Average( C,10 ) then
buy next bar market;
if Average( C, 5 ) < Average( C,10 ) then
sellshort next bar market;
//以上是你原本的策略程式碼,下方加上這一句就行了。
_ShowStrategy;
Now,try it !