希望哪位前辈指点一下,如何在ami实现声音报警和买卖箭头提示功能

Discussion in 'AmiBroker' started by xiyun, Nov 5, 2008.

  1. 如何编写一个指标,比如满足一个条件,价位或者指标交叉或者等于一个数值,就可以出现声音报警和主图上面的上下箭头提示买卖时机,希望详细指点,我的qq:377970700,tygxy@163.com 迫切期待高手前辈热心指点, 非常感谢。
     
  2. 我还没有步入自编的阶段,不过帮忙顶个人气~
     
  3. 帮助文件里有,找alerts单词。

    ALERTIF
    - trigger alerts Trading system toolbox
    (AFL 2.1)


    SYNTAX AlertIf( BOOLEAN_EXPRESSION, command, text, type = 0, flags = 1+2+4+8, lookback = 1 );
    RETURNS nothing
    FUNCTION Triggers alert action if BOOLEAN_EXPRESSION is true.
    1. BOOLEAN_EXPRESSION is the expression that if evaluates to True (non zero value) triggers the alert. If it evaluates to False (zero value) no alert is triggered. Please note that only lookback most recent bars are considered.

    2. The command string defines the action taken when alert is triggered. If it is empty the alert text is simply displayed in the Alert output window (View->Alert Output). Other supported values of command string are:
    SOUND the-path-to-the-WAV-file
    EMAIL
    EXEC the-path-to-the-file-or-URL

    SOUND command plays the WAV file once.
    EMAIL command sends the e-mail to the account defined in the settings (Tools->Preferences->E-mail). The format of the e-mail is as follows: Subject: Alert type_name (type) Ticker on Date/Time
    Body: text
    EXEC command launches external application or file or URL specified after EXEC command. are attached after file name and text is attached at the end

    3. Text defines the text that will be printed in the output window or sent via e-mail or added as argument to the application specified by EXEC command

    4. Type defines type of the alert. Pre-defined types are 0 - default, 1 - buy, 2 - sell, 3 - short, 4- cover. YOu may specify higher values and they will get name "other"

    5. Flags control behaviour of AlertIF function. This field is a combination (sum) of the following values:
    ( 1 - display text in the output window, 2 - make a beep (via computer speaker), 4 - don't display repeated alerts having the same type, 8 - don't display repeated alerts having the same date/time) By default all these options are turned ON.

    6. lookback parameter controls how many recent bars are checked

    EXAMPLE Buy = Cross( MACD(), Signal() );
    Sell = Cross( Signal(), MACD() );
    Short = Sell;
    Cover = Buy;
    AlertIF( Buy, "EMAIL", "A sample alert on "+FullName(), 1 );
    AlertIF( Sell, "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2 );
    AlertIF( Short, "EXEC Calc.exe", "Launching external application", 3 );
    AlertIF( Cover, "", "Simple text alert", 4 );

    Note EXEC command uses ShellExecute function and allows not only EXE files but URLs too.
    SEE ALSO
     
  4. 上下箭头提示:

    shape = Buy * shapeUpTriangle + Sell * shapeDownTriangle;
    PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );

    声音报警:
    WJ2000兄提到的alertif就挺好用
    也可以用操作系统的语音引擎
    Say(''text'', purge = True)

    缺点:
    1,只要信号还在,会一直不停发音
    2,中文语音估计不行(alertif可以)

    if(lastvalue(buy)) Say("buy");
    if(lastvalue(buy)) Say("sell");
     
  5. 我是新手,看不懂你们写的具体该如何处理。请问这个箭头指标是怎么添加啊?和均线指标复制编辑到一起?如果方便请给我个示范,比如,当kd金叉时在主图出现买入箭头,死叉时出现卖出,或者当k值等于或者大于90时想在主图出现做空下的箭头?是编辑在kd指标里面,还是编辑在主图指标里面?希望给个示范看看。这个是如何编辑导入啊?期待指点,我的qq:377970700。非常感谢
     
  6. Days=Param("KD Range",14,1,20);//Parameter for KD
    k=StochK(Days) ;
    d=StochD(Days) ;

    Buy=Cross(k,d);
    Sell=Cross(d,k);

    shape = Buy * shapeSmallUpTriangle + Sell * shapeSmallDownTriangle;
    PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );//draw the buy/sell indicator
    if(LastValue(Buy)) Say("buy");
    if(LastValue(Sell)) Say("sell");

    kdcolor=IIf(k>=90,colorYellow,colorBlack);//if K greater or equal to 90,set bar color to yellow
    Plot(C,"close",IIf(k>=90,7,1),64); //draw the candle bars
    Plot(MA(C,10),"MA AVG",colorBlue,5);//plot the MA line


    如果真用这软件,还是建议要多读手册阿
     
  7. 提示一下:ALERTIF 和 STATIC VARIABLE 相结合,可以只发出一次声音警报。
     
  8. 你好,我把你写的和我自己的kd指标一起编辑进去,出现小三角提示了,可是不是我想要的那种指示结果,你有什么联络方式,希望具体指点一下啊?我的qq:377970700,msn:wypzh89@hotmail.com 期待回复
     
  9. N = param("Range", 9, 2, 20, 1);
    M1 = param("%K Period", 3, 1, 20, 1);
    M2 = param("%D Period", 3, 1, 20, 1);

    RSV = (CLOSE - LLV(LOW, N))/(HHV(HIGH, N)- LLV(LOW, N)) * 100;
    K = EMA(RSV, M1);
    D = EMA(K, M2);
    J = 3 * K-2 * D;
    plot(J, "Stochastic %J", colorred);
    plot(D, "Stochastic %D", colorblue);
    plot(K, "Stochastic %K", colorgreen);
    plot(80, "", colorblack);
    plot(20, "", colorblack);
    _SECTION_END()
    请问如何在这个kjd指标里面加入当j大于90时想在主图出现做空向下的箭头?是编辑在这个指标里面,还是编辑在主图指标里面?希望给写个示范看看。期待具体指点,我的qq:377970700。非常感谢
    我增加了下面这个,说是无法编辑,我不知道该怎么办了
    Buy=( Buy, Sell );
    Sell=( Buy, Sell );

    shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
    PlotShapes( shape, IIf( Buy, colorRed ,colorGreen ), 0, IIf( Buy, J<=5, J>=90 ) );//draw the buy/sell indicator
     

  10. 请问你有什么可以方便的联络方式,希望加我具体指点一下,这样子讲我还是不明白,非常感谢
     
  11. 请问如何编写只发几声的报警?希望高人给写个示范看看,非常感谢