|
參考了Ray's blog的移動停利函數寫法概念,由於要不到原程式碼只好自己寫了。
函數:NetTrailling(獲利點數,拉回百分比或點數)
inputs: N(numericsimple),ratio(numericsimple);
NetTrailling=iff(ratio>1 and (highest(high,barssinceentry)-entryprice>N) and marketposition>1,highest(high,barssinceentry)-ratio,0 );
NetTrailling=iff(ratio<1 and (highest(high,barssinceentry)-entryprice>N) and marketposition>1,highest(high,barssinceentry)-ratio*(highest(high,barssinceentry)-entryprice),0 );
NetTrailling=iff(ratio>1 and (entryprice-Lowest(low,barssinceentry)>N) and marketposition<1,Lowest(low,barssinceentry)+ratio,0 );
NetTrailling=iff(ratio<1 and (entryprice-Lowest(low,barssinceentry)>N) and marketposition<1,Lowest(low,barssinceentry)+ratio*(entryprice-Lowest(low,barssinceentry)),0 );
套用到訊號裡面會出現最大K棒根數需大於多少根的錯誤,並強制關掉訊號。
請問是那邊出錯了?謝謝!!
|
|