请教指定时间的AFL

Discussion in 'AmiBroker' started by WSC, Dec 7, 2012.

  1. WSC

    WSC

    如题:
    现希望在每天9:59AM作买卖决定,条件是:Buy=Cross(C,x); Sell=Cross(x,C);
    也就是在9:59时如巳处于买条件则立即买,反之而然。

    谢谢。
     
  2. SYNTAX ParamTime( ''Name'', ''Default time'', format = 0 );
    RETURNS NUMBER or STRING
    FUNCTION Adds a new user-definable time parameter, which will be accessible via Parameters dialog :
    right click over chart pane and select "Parameters" or press Ctrl+R allows to change chart parameters - changes are reflected immediatelly.

    "name" - defines parameter name that will be displayed in the parameters dialog
    "default time" - is a string holding time in any any format: HH:MM:SS, HH:MM, etc.
    format - defines return value format, allowable values are:
    0 - return value is a NUMBER and holds TimeNum. Ie: 133515 for 13:35:15
    1 - return value is a STRING formatted holding time according to your windows regional settings

    atime=paramtime(...................
    if (now(4)==atime) .............
     
  3. WSC

    WSC

    我表达不清楚,这是一日内交易策略:每天在某一时间(这里选9:59AM)一定要做第一个交易(Long or Short),而此时符合Buy 条件的就Long,反之则Short。
     
  4. trade_time = ParamTime( " Trade End", "09:59:59" ) ;
    if (lastvalue(now(4)==trade_time and (buy or sell)))
    {.................}
     
  5. buy = TimeNum() == 095959 AND .....
     
  6. WSC

    WSC

    谢谢楼上两位。