Board logo

标题: 让指标符合条件时,发出警告[MC] [打印本页]

作者: 龙听    时间: 2017-12-28 11:14     标题: 让指标符合条件时,发出警告[MC]

Multicharts/Tradestation 的Alerts/警示功能,蛮常用的..
看盘时当条件符合时,可发出声音来提示.
使用RSI 来举例,当大于70,及小于30要发出声音做警示

程序写法如下:

  1. inputs:Price( Close ),Length( 14 ),OverSold( 30 ),OverBought( 70 ),OverSColor( Cyan ),OverBColor( Red ) ;

  2. variables: var0( 0 ) ;

  3. var0 = RSI( Price, Length ) ;
  4. Plot1( var0, "RSI" ) ;Plot2( OverBought, "OverBot" ) ;Plot3( OverSold, "OverSld" ) ;

  5. if var0 > OverBought
  6. then
  7. SetPlotColor( 1, OverBColor ) else
  8. if  var0 < OverSold
  9. then
  10. SetPlotColor( 1, OverSColor ) ;//这里提一下,这是让线变色的写法.
  11. //==到这里都是RSI 指标
  12. condition1 = var0 crosses over OverSold ;
  13. if condition1
  14. then
  15. PlaySound("C:\Windows\Media\WindowsBalloon.wav")  //填上音效的档案路径 else
  16. begincondition1 = var0 crosses under OverBought;
  17. if condition1
  18. then
  19. PlaySound("C:\Windows\Media\ring.wav");//填上音效的档案路径
  20. end;
复制代码





欢迎光临 龙听期货论坛 (http://www.qhlt.cn/) Powered by Discuz! 7.2