欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件策略编写求助区 → 海龟经典软件-TRADING BLOX策略

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有12090人关注过本帖平板打印复制链接

主题:海龟经典软件-TRADING BLOX策略

帅哥哟,离线,有人找我吗?
solarhe2006
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:252 积分:1001 威望:0 精华:0 注册:2010/2/15 16:47:58
海龟经典软件-TRADING BLOX策略  发帖心情 Post By:2011/3/30 21:34:28 [只看该作者]

Entry Orders:

VARIABLES: longEntryPrice, shortEntryPrice, unitIncrementATR, unitEntryPrice TYPE: Price

VARIABLES: entryOffsetATR TYPE: Price

VARIABLES: unitsOn, unitIndex TYPE: Integer

VARIABLES: brokerPrice TYPE: Price

 

' Calculate the unit increment, stop amount, and entry offset

unitIncrementATR = unitAdd * averageTrueRange

stopWidth = stopInATR * averageTrueRange

 

'Total units currently on for this instrument

unitsOn = instrument.totalUnits

 

'----------------------------------------------------------------

'Place initial entry orders when out of the market

'----------------------------------------------------------------

 

' If we are not long (we are short or out) then place orders for tomorrow

' We will place orders for all potential units in case it's a big day

IF instrument.position <> LONG THEN

 

    ' Determine whether to use the regular entry high or the failsafe

    longEntryPrice = offsetAdjustedEntryHigh

    IF ( NOT tradeIfWinner ) AND ( lastTradeProfit > 0 ) THEN longEntryPrice = offsetAdjustedFailsafeHigh

    

    ' Loop over the potential units and place an order

    FOR unitIndex = 1 TO maxUnits

        brokerPrice = longEntryPrice + ( ( unitIndex - 1 ) * unitIncrementATR )

        broker.EnterLongOnStop( brokerPrice, brokerPrice - stopWidth )

    NEXT

    

ENDIF

 

' If we are not short (we are long or out) then place orders for tomorrow

' We will place orders for all potential units in case it's a big day

IF instrument.position <> SHORT THEN

 

    ' Determine whether to use the regular entry low or the failsafe

    shortEntryPrice = offsetAdjustedEntryLow

    IF ( NOT tradeIfWinner ) AND ( lastTradeProfit > 0 ) THEN shortEntryPrice = offsetAdjustedFailsafeLow

    

    ' Loop over the potential units and place an order

    FOR unitIndex = 1 to maxUnits

        brokerPrice = shortEntryPrice - ( ( unitIndex - 1 ) * unitIncrementATR )

        broker.EnterShortOnStop( brokerPrice, brokerPrice + stopWidth )

    NEXT

    

ENDIF

 

'----------------------------------------------------------------

'Add additional Units when already in the market

'----------------------------------------------------------------

 

'If long and can add more units

IF ( instrument.position = LONG ) AND ( unitsOn < maxUnits ) THEN 

 

    ' Loop over potential units to add, placing orders at maximum of regular entryHigh or unit increment

    FOR unitIndex = unitsOn + 1 TO maxUnits

        unitEntryPrice = instrument.unitEntryFill[ unitsOn ] + ( unitIndex - unitsOn ) * unitIncrementATR

        brokerPrice = max( offsetAdjustedEntryHigh, unitEntryPrice )

        broker.EnterLongOnStop( brokerPrice, brokerPrice - stopWidth)

    NEXT

ENDIF

 

'If short and can add more units

IF ( instrument.position = SHORT ) AND ( unitsOn < maxUnits ) THEN 

 

    ' Loop over potential units to add, placing orders at minimum of regular entryLow or unit increment

    FOR unitIndex = unitsOn + 1 TO maxUnits

        unitEntryPrice = instrument.unitEntryFill[ unitsOn ] - ( unitIndex - unitsOn ) * unitIncrementATR

        brokerPrice = min( offsetAdjustedEntryLow, unitEntryPrice )

        broker.EnterShortOnStop( brokerPrice, brokerPrice + stopWidth )

    NEXT

ENDIF


 回到顶部
总数 11 1 2 下一页