New to Thinkscript and trying to clean up some code I have in place.
Currently I have code that once a condition is met [LongStoch], I use the painstrategy to mark an Up Arrow on the price chart at the point the first time the condition is met. If the condition occurs again before the reverse condition [SellStoch] occurs, another Up Arrow will be marked on the price chart, making for a pretty cluttered price chart.
What I am looking for help with, is to modify the code so that once a "buy condition" is met, only one price chart arrow will be placed, until the "sell condition" [SellStoch] occurs placing the opposite arrow on the price chart, and then the next buy after the sell can again place a buy arrow on the price chart.
Current code set:
Currently I have code that once a condition is met [LongStoch], I use the painstrategy to mark an Up Arrow on the price chart at the point the first time the condition is met. If the condition occurs again before the reverse condition [SellStoch] occurs, another Up Arrow will be marked on the price chart, making for a pretty cluttered price chart.
What I am looking for help with, is to modify the code so that once a "buy condition" is met, only one price chart arrow will be placed, until the "sell condition" [SellStoch] occurs placing the opposite arrow on the price chart, and then the next buy after the sell can again place a buy arrow on the price chart.
Current code set:
Code:
Plot LongStoch = “Angle, deg” crosses above 0 and (“AngleK2, deg” > 0 or “AngleK3, deg” > 0) and UseLongs
or
MACD(12,26,9).Value > MACD(12,26,9).Avg and FullK crosses above FullD and UseLongs;
LongStoch.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
Plot SellStoch = (“AngleK2, deg” crosses below 0 and FullK_2 < Overbought and UseLongs and MACD(12,26,9).diff < MACD(12,26,9).diff [1]) or MACD(12,26,9).Value crosses below MACD(12,26,9).Avg;
SellStoch.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);