这样精确控制进场条件

Discussion in 'AmiBroker' started by gravedancer, Sep 7, 2012.

  1. 请问各位大大 我怎样精确在AB里控制进场条件
    比如Signal Bar是CLOSE 上穿MA(C,20) ,Entry Price 是Signal Bar的HIGH 我的Entry Bar 是 在Signal Bar 后面的5个bar 以内 第一个Bar HIGH 大于EntryPrice的(使用STOP单) 或者开盘价(如果GAPUP 同时还要满足该EntryBar的最低价在当时MA(C,20) 之上
    5个BAR之内没有符合条件的ENTRY BAR 该次Signal Bar就忽略 平仓条件就是MA下穿 但是的BAR 使用被下穿时的MA 价
    我自己只能想出用BarCount的LOOP 有没有简洁高效的代码实现这种条件多点的入场?
    需要的话我可以贴出我想出的 比较笨的代码:D
     
  2. do not know what you talking about. can not help.
     
  3. Suppose a simple Long only system:the entry signal will be the bar which close cross above MA(C,20),this is we called signal bar,record this signal bar's HIGH as the entry price ,the entry bar is in the next 5 bars ,the first bar which open above MA(20) and its HIGH penetrate the entry price,in other words,i want BUY HIGH(usually using STOP Order in the real trade) within the 5 bars after the signal bar ,how to implement it on AB with simply/effective code?i can figure out using the BARCOUNT loop but it is a cumbersome way
     
  4. 这几个函数中应该有能用到的:

    HHV - highest high value
    HHVBars - bars since highest high
    Highest - highest value
    HighestBars - bars since highest value
    HighestSince - highest value since condition met (AFL 1.4)
    HighestSinceBars - bars since highest value since condition met (AFL 1.4)
    LLV - lowest low value
    LLVBars - bars since lowest low
    Lowest - lowest value
    LowestBars - bars since lowest
    LowestSince - lowest value since condition met (AFL 1.4)
    LowestSinceBars - barssince lowest value since condition met (AFL 1.4)

    http://www.amibroker.com/guide/afl/afl_index.php?m=2
     
  5. 还是loop比较好理解
     
  6. signal_high= valuewhen(cross(c,ma(c,20)),h,1) ;
     
  7. Thks ,useful tip