NexusFi: Find Your Edge


Home Menu

 





Seemingly unsolvable error messages in ThinkorSwim Alerts


Discussion in ThinkOrSwim

Updated
    1. trending_up 4,504 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
Txurruka
Cocoa, Florida, United States
 
Posts: 1 since Oct 2010
Thanks Given: 0
Thanks Received: 0

I am new to programming, and I think I understand the code below, I just can't understand why the editor won't accept it.

I copy/pasted the code for MA_Crossover_w_Alerts released by think or swim into the complex alert compiler. Everything is functioning except the alerts portion at the bottom. The following is written:

#Trigger alerts
alert(crossover[1], "Crossover", Alert.Bar, Sound.Ding);
alert(crossunder[1], "Crossunder", Alert.Bar, Sound.Ding);

Every time I paste that in, the scripter creates the error "No such constant: Sound.Ding" I know for a fact that Sound.Ding is a valid constant (it is in the thinkscript manual), I just don't know why it won't acknowedge it. Further, the compiler rejects all “Sound._” constants that are in the manual. I tried to just leave out the sound parameter altogether, since the manual indicates that it will default in that instance to Sound.NoSound, but then it gives me this error: "No default value for parameter 'parameter3' on alert". I talked to someone else that tried the same code in their own TOS program, and he didn't have any of the issues I'm having. He didn't tell me anything beyond that, though, so I'm kind of stuck.

To be clear, the whole script released from Think or Swim is as follows:


input EMAPeriod = 10;
input SMAPeriod = 20;
input price = close;
def na = double.nan;

plot fastema = ExpAverage(price, EMAPeriod);
plot slowema = Average(price, SMAPeriod);
def crossover = if fastema > slowema AND fastema[1] <= slowema[1] then 1 else 0;
def crossunder = if fastema < slowema AND fastema[1] >= slowema[1] then 1 else 0;

#Plot arrows
Plot up = if crossover then low - tickSize() else na;
Plot down = if crossunder then high + tickSize() else na;
up.SetPaintingStrategy(paintingStrategy.ARROW_UP);
down.SetPaintingStrategy(paintingStrategy.ARROW_DOWN);

#Trigger alerts
alert(crossover[1], "Crossover", Alert.Bar, Sound.Ding);
alert(crossunder[1], "Crossunder", Alert.Bar, Sound.Ding);




Thank you for any help you can provide!


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NinjaTrader Parent Payward Acquires Bitnomial for $550M …
Platforms and Indicators
Election Sunday Resolves: Peru Heads to Runoff at 42pct, …
Prediction Markets & Event Contracts
El Clasico Draws $9.2M in Prediction Market Action -- Bi …
Prediction Markets & Event Contracts
April FOMC Minutes: Most Divided Fed Since 1992 -- Many …
Traders Hideout
March Jobs Report Update: 178K Beat vs 59K Expected, Wag …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
205 thanks
Sober Journey With S&P
21 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
Thanks Mike. Godspeed.
7 thanks




Last Updated on October 13, 2010


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts