标题:
PLE語法筆記-計價基礎
[打印本页]
作者:
龙听
时间:
2020-9-2 08:56
标题:
PLE語法筆記-計價基礎
價位是交易的基礎,在一根K棒內會有:
open high low close
复制代码
以上4個價位,當K棒未完成時最新的價格都是close
交易進出價位
Entryprice(0): 目前部位第一筆進場價位,可輸入數字抓出前幾次的進場
avgentryprice: 目前部位平均進場價位
复制代码
運用上述就能撰寫停損停利的條件
固定計價基礎
# 固定點數
input: long_SL_pts(80), short_SL_pts(120);
if MP > 0 then
sell("Long SL") next bar at (entryprice-long_SL_pts) stop;
if MP < 0 then
buytocover("Short SL") next bar at (entryprice+short_SL_pts) stop;
# 固定%數
input: long_SL_per(0.7), short_SL_per(0.6);
if MP > 0 then
sell("Long SL") next bar at (entryprice*(100-Long_SL_per)*0.01) stop;
if MP < 0 then
buytocover("Short SL") next bar at (entryprice*(100+Short_SL_per)*0.01) stop;
复制代码
變動計價基礎
個人偶而會以ATR做為計量基礎,代替固定點數或固定%數
input: long_SL_nATR(2.5), short_SL_nATR(3.8);
var: ATR(0), ATR_len(5);
ATR = AvgTrueRange(ATR_len);
if MP > 0 then
sell("long SL") next bar at (entryprice-long_SL_nATR*ATR) stop;
if MP < 0 then
buytocover("short SL") next bar at (entryprice+short_SL_nATR*ATR) stop;
复制代码
欢迎光临 龙听期货论坛 (http://www.qhlt.cn/)
Powered by Discuz! 7.2