Thanks @SleepyZ I don't know how to get the exact price when message center that triggers the alert.
I need that price for an accurate back-testing; otherwise, I get unrealistic results using the 'close' price.
Ruby:Alert(volume>volume[1], "VOLUME " + volume + " " + close, Alert.BAR, Sound.Ring);
Is there a way to know the 'price' at the moment an study alert is triggered, is that possible?
E.g. If I set this ---> Alert(volume>volume[1], "VOLUME", Alert.BAR, Sound.Ring);
How could I know the exact price when the 'Ring' is triggered? That's is key for backtesting.
Ruby:Alert(volume>volume[1], "VOLUME " + volume, Alert.BAR, Sound.Ring);
Thanks @SleepyZ I don't know how to get the exact price when message center that triggers the alert.I am not aware of a thinkscript way, but the Message Center seems to be one option.
Thanks @SleepyZ I don't know how to get the exact price when message center that triggers the alert.
I need that price for an accurate back-testing; otherwise, I get unrealistic results using the 'close' price.
Ruby:Alert(volume>volume[1], "VOLUME " + volume + " " + close, Alert.BAR, Sound.Ring);
Thanks a lot, and do you know if I can add similar text to replace close[-1] at the order so I can get the same price as message center?Added close to the alert and it appears to be the exact volume and price when the alert occurred that shows in the message center
https://usethinkscript.com/threads/strategy-alerts-in-thinkorswim.8711/Thanks a lot, and do you know if I can add similar text to replace close[-1] at the order so I can get the same price as message center?
def buySig = close and volume>volume[1];
def buyPrice = if open[-1] and volume>volume[1] then open[-1] else close[-1];
AddOrder(OrderType.BUY_TO_OPEN, buySig[-1], price = buyPrice, tradeSize = 1, tickcolor = Color.GREEN, arrowcolor = Color.GREEN, name = "Buy");
All I need is that my strategy report shows same price that I see in the message center when the volume condition alert triggers.Added close to the alert and it appears to be the exact volume and price when the alert occurred that shows in the message center
Please see the link to the above post https://usethinkscript.com/threads/get-price-when-alert-is-triggered.9367/post-85000Can I get an script text that give me at the Order the same price from the Alert at message center?
def buySig = close and volume>volume[1];
def buyPrice = if open[-1] and volume>volume[1] then open[-1] else (here I need the Alert price);
AddOrder(OrderType.BUY_TO_OPEN, buySig[-1], price = buyPrice, tradeSize = 1, tickcolor = Color.GREEN, arrowcolor = Color.GREEN, name = "Buy");
Ok, but for realistic back-test, I need an script or text that give me the 'message center price' to add into the 'strategy script', otherwise any back-test become false.Please see the link to the above post https://usethinkscript.com/threads/get-price-when-alert-is-triggered.9367/post-85000
You would probably have to run the backtest on OnDemand so that the message center price is created and compare that to the strategy price. I have not done this.
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.