May ask you about another thing, I have read about supertrend indicator from ninjatrader, I already ask many people about the logic behind that supertrend. I want to put it on my thinkorswim study. Coudl you tell me about the logic, because I can't figure it from the source code. I don't know about C# language.
You could click studies in TOS, choose edit studies ....
Click on VSA studies,
In the down side, there will be the properties, ..
from input criteria, slide it doew, then you could see color bar...
the default value is false, change it to true .
Thanks for the great study, C. I've been experimenting with it over the past few days and intend to make it a permanent part of my trading screen. I am confused about the display of Very High in the Close field of the banner, however. It seems to display Very High where it should display Very Low. High, Mid, and Down seem to work fine, as does Very High for a bar that closes at the top. I've noticed that it seems to default to Very High on the opening of a bar and will also display Very High as a bar grows to the downside or if the bar closes at its low. Here are the two sections of code that might account for this:
# Check if the close is in the Highs/Lows/Middle of the bar.
def x1 = if (close == low) then avgSpread else (spread / (close - low));
def isUpCloseBar = (x1 < 2);
def isDownCloseBar = (x1 > 2);
def isMidCloseBar = (x1 < 2.2 && x1 > 1.8);
def isVeryHighCloseBar = (x1 < 1.35);
AddChartLabel(trendText, concat("Close: ", if (isVeryHighCloseBar) then "Very High"
else if (isUpCloseBar) then "High"
else if (isMidCloseBar) then "Mid"
else if (isDownCloseBar) then "Down"
else "Very Low"), Color.white);
I double checked the original NT version. It has the same logic:
I do think this is a valid concern. If close = low for the bar, then x1 is set to the average spread. So if the average spread is < 1.35, the result will be a "very high" close bar, which makes no sense since the close = low. It would reason that this piece of code needs to be reworked a bit. Clearly, if close = low, then it should be "very low", not "very high". However, cases where close = low = high should be taken into consideration as well.
Thanks for the good find! The reason I started this tread is to have peer reviews like this.
“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu