Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Play sound when target/stop is reached via Strategy Wizard

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Play sound when target/stop is reached via Strategy Wizard

    trying to include a sound file via the wizard to play when either a target or stop is filled...

    Code:
    [FONT=Courier New][SIZE=2][COLOR=#0000ff]#region[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] Variables[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2][COLOR=#008000]// Wizard generated variables[/COLOR][/SIZE][/FONT]
    [FONT=Courier New][SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] downtrade = [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]; [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000]// Default setting for Downtrade[/COLOR][/SIZE][/FONT]
    [FONT=Courier New][SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] uptrade = [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]; [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000]// Default setting for Uptrade[/COLOR][/SIZE][/FONT]
    [FONT=Courier New][SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] tp_ticks = [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]9[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]; [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000]// Default setting for Tp_ticks[/COLOR][/SIZE][/FONT]
    [FONT=Courier New][SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] stop_ticks = [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]16[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]; [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000]// Default setting for Stop_ticks[/COLOR][/SIZE][/FONT]
    [FONT=Courier New][SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] trade_time = [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]; [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000]// Default setting for Trade_time[/COLOR][/SIZE][/FONT]
    [FONT=Courier New][SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] period = [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]; [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000]// Default setting for Period[/COLOR][/SIZE][/FONT]
    [FONT=Courier New][SIZE=2][COLOR=#008000]// User defined variables (add any user defined variables below)[/COLOR][/SIZE][/FONT]
    [FONT=Courier New][SIZE=2][COLOR=#0000ff]#endregion[/COLOR][/SIZE][/FONT]
    [FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]<summary>[/COLOR][/SIZE][/FONT]
    [FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000] This method is used to configure the strategy and is called once before any strategy method is called.[/COLOR][/SIZE][/FONT]
    [FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]</summary>[/COLOR][/SIZE][/FONT]
    [FONT=Courier New][SIZE=2][COLOR=#0000ff]protected[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]override[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] Initialize()[/SIZE][/FONT]
    [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
    [SIZE=2][FONT=Courier New]SetProfitTarget([/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800000]""[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2], CalculationMode.Ticks, Tp_ticks);[/SIZE][/FONT]
    [SIZE=2][FONT=Courier New]SetStopLoss([/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800000]""[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2], CalculationMode.Ticks, Stop_ticks, [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]);[/SIZE][/FONT]
    [SIZE=2][FONT=Courier New]CalculateOnBarClose = [/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2];[/SIZE][/FONT]
    [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]

    #2
    It is not possible to play a custom sound when orders generated from the SetStopLoss() and SetProfitTarget() methods are filled.
    RayNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    559 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    546 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X