以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]请老师转换。。。急,在线等  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=11263)

--  作者:gxc
--  发布时间:2012/4/24 15:20:47
--  [求助]请老师转换。。。急,在线等
    If(BarsSinceentry == 0)
    {
        HighestAfterEntry = Close;
        LowestAfterEntry = Close;
        If(MarketPosition <> 0)
        {
            HighestAfterEntry = Max(HighestAfterEntry,AvgEntryPrice);   // 开仓的Bar,将开仓价和当时的收盘价的较大值保留到HighestAfterEntry
            LowestAfterEntry = Min(LowestAfterEntry,AvgEntryPrice);     // 开仓的Bar,将开仓价和当时的收盘价的较小值保留到LowestAfterEntry
        }
    }else
    {
        HighestAfterEntry = Max(HighestAfterEntry,High); // 记录下当前Bar的最高点,用于下一个Bar的跟踪止损判断
        LowestAfterEntry = Min(LowestAfterEntry,Low);    // 记录下当前Bar的最低点,用于下一个Bar的跟踪止损判断
    }

--  作者:rushtaotao
--  发布时间:2012/4/24 15:23:08
--  

试着给您转一下 稍等

 


--  作者:rushtaotao
--  发布时间:2012/4/24 15:44:19
--  
variable:HighestAfterEntry=0;
variable:LowestAfterEntry=0;
If ENTERBARS=0 then
    begin
        HighestAfterEntry:=Close;
        LowestAfterEntry:=Close;
        If(holding <> 0) then
        begin       
            HighestAfterEntry:= Max( HighestAfterEntry,AVGENTERPRICE  );   // 开仓的Bar,将开仓价和当时的收盘价的较大值保留到HighestAfterEntry
            LowestAfterEntry:= Min(LowestAfterEntry,AVGENTERPRICE);     // 开仓的Bar,将开仓价和当时的收盘价的较小值保留到LowestAfterEntry
        end
    end
if  ENTERBARS<>0 then
begin  
        HighestAfterEntry:= Max(HighestAfterEntry,High); // 记录下当前Bar的最高点,用于下一个Bar的跟踪止损判断
        LowestAfterEntry:= Min(LowestAfterEntry,Low);    // 记录下当前Bar的最低点,用于下一个Bar的跟踪止损判断
end