一、回顾上次课程介绍。
二、函数的使用。
三、交易思想转化为策略代码。
更多问题解答,欢迎加入技术交流QQ群:37520968
课后练习代码参考:
inputs:N(10);
var:Baseprice(0),B1(0),B2(0),S1(0),s2(0);
if date<>date[1] then begin
Baseprice=Open;
B1=Baseprice+N;
S1=Baseprice-N;
end;
if marketposition=0 and currentcontracts=0 then begin
sellshort("S1") next bar at B1 limit;
buy ("B1") next bar at S1 limit;
end;
if marketposition<>0 then begin
buytocover from entry("S1") next bar at Baseprice limit;
sell from entry("B1") next bar at Baseprice limit;
end;