以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  公式模型编写问题提交  (http://222.73.7.161/bbs/list.asp?boardid=4)
----  [求助]括号错在哪里?  (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=160274)

--  作者:lizhi
--  发布时间:2017/12/8 15:43:19
--  [求助]括号错在哪里?

括号错在哪里?谢谢老师指导

 


图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看

--  作者:FireScript
--  发布时间:2017/12/8 15:49:29
--  

第二行代码 后面缺了一个:)


--  作者:lizhi
--  发布时间:2017/12/8 16:06:08
--  

 //如果有多仓
 if MyRealMp > 0 and HighAfterLongEntry - low >= 移动止损额 and (high-low<移动止损额 or(high-low>=移动止损额 and close<open)) then begin
  TmpPrice := Max(HighAfterLongEntry-(TrailingGrid-OffSet)*Minpoint,Low);
  TmpLots  := Abs(MyRealMP*EveryLots);
  Sell(TmpLots,TmpPrice);
  MyRealMP := 0;
  LowAfterShortEntry := Low;
 end

 

以上错在哪里?


--  作者:FireScript
--  发布时间:2017/12/8 16:21:31
--  
MyRealMp 都没有定义。肯定会出错。
--  作者:lizhi
--  发布时间:2017/12/8 17:50:27
--  

Runmode:0;
Input:FirstGrid(30);//第一笔交易的间距,最小跳动
Input:AddGrid(5);//加仓间距,最小跳动
Input:TotalGrids(10);//最大交易次数
Input:TrailingGrid(30);//移动止损跳数
Input:EveryLots(1);//每次开仓手数
Input:OffSet(1);//委托价偏差,默认买卖价偏差1个滑点
Variable:MyRealMp=0,HighAfterLongEntry=0,LowAfterShortEntry=0;

MinPoint := mindiff*multiplier,nodraw;//每跳变动价值
IF BARPOS =1 OR MyRealMp = 0 OR MyRealMp = NODRAW THEN MyRealMp:=0;//初始化当前仓位为0
//计算出开市以来的最高价与最低价-------------------------------------------------------
if date<>date[1] then begin
 HighAfterLongEntry:=high;
 LowAfterShortEntry:=low;
 MyRealMp:=0;
end
else begin
 HighAfterLongEntry := max(HighAfterLongEntry,high);
 LowAfterShortEntry := min(LowAfterShortEntry,low);
end
//----------------------------------------------------------------------------------
移动止损额:=TrailingGrid*MinPoint;
IF time <145800 then begin
 //如果有多仓
 if MyRealMp > 0 and HighAfterLongEntry - low >= 移动止损额 and (high-low<移动止损额 or(high-low>=移动止损额 and close<open)) then begin
  TmpPrice := Max(HighAfterLongEntry-(TrailingGrid-OffSet)*Minpoint,Low);
  TmpLots  := Abs(MyRealMP*EveryLots);
  Sell(TmpLots,TmpPrice);
  MyRealMP := 0;
  LowAfterShortEntry := Low;
 end

end

[此贴子已经被作者于2017/12/8 17:50:49编辑过]

--  作者:wenarm
--  发布时间:2017/12/8 22:39:30
--  
编译可以正常通过,你楼上的代码存在什么问题