♥ 0 |
Hi Pete, Thank you so much for the great tutorials & content. Your site is a fantastic resource and I’m so glad I stumbled upon it. Did my best to search through the existing posts and I did find a couple of posts that were variations of what I’m looking to do but not exactly what I was looking for. Since I’m new to coding, I figured I’d just ask and see if I can get pointed in the right direction. I wanted to see if there is a way to create a custom conditional wizard watch list that returns a “1” with green background when the Exponential Moving Average cross above the VWAP and a “0” when the Exponential Moving Average crosses below the VWAP? Any help would be tremendously appreciated. John Michael
Marked as spam
|
Private answer
You can't actually accomplish this using the Condition Wizard. Not without modifying the code that it generates. So we can generate the individual components from the Condition Wizard, from which we can assemble the final solution. For full details on using the Condition Wizard to build custom watchlist solutions see the following video: https://www.hahn-tech.com/thinkorswim-condition-wizard-watchlist/ So using the Condition Wizard we can generate the code for each of your two conditions. This is the output:
Now I will step you through the modifications: Assign each of these statement to variables:
Notice the only thing we did there was to add the 'def' declaration, followed by the variable name and added a semicolon to the end. Now we can use those variable names for the plot statement, which is the line of code that displays the value in the custom watchlist column.
Notice this will output a value of +1 when the moving average crosses above the VWAP and a -1 when the moving average crosses below the VWAP. Be sure to realize that you requested the cross event and not the relative position of these two lines. So this means each candle has 3 possible conditions:
So we need to use three values to display the conditions you requested. If you actually just wanted this to be +1 if moving average is above and zero if moving average is below (not the actual crossing events but the relative positions of those two lines) well you would not have needed to post in the Q&A forum because that could have very easily have been accomplished using the condition wizard without any modifications whatsoever. Marked as spam
|
Please log in to post questions.