is it hard to to a buy on first green and sell on first red strategy added to this study?
# A very basic order entry, repaint is a problem, as the strategy looks great on backtest but not so good in real timei meant to create a strategy from this rather than an indicator
Click on Studies then you will see a TAB for Strategies, click Create, then you must include some sort of AddOrder statement at the end of what ever you are using to signal the buy or sellNewbie here. Trying to learn how to create my own strategy within TOS. How are you backtesting, I don't see a script? Is the backtesting not in TOS? Also, does any of the studies repaint which would alter the backtest?
I am brand new here myself working on a different coding task, but I wonder during back-testing the scoring threshold numbers were changed... Maybe at one point there were more than 3 Bullish or Bearish indicators needed to color bars...
#COLORBARS AssignPriceColor( if PaintBars then if ADXPaintBarsMode then if ADX > ADXTrending then COLOR.ORANGE else COLOR.DARK_GRAY else if ADX < ADXTrending then color.light_gray else if bullish then COLOR.uptick else if bearish then COLOR.downtick else if enableNeutralMACDPainter then if macd_Val_1 > macd_Avg1 then COLOR.DARK_GREEN else COLOR.DARK_RED else COLOR.GRAY else COLOR.CURRENT);
It indicates if the ADX is indicating a trending or choppy market. Gray means choppy, yellow means trending. In the options section of the study you can disable this by turning off the ADX bar. I recommend doing this if you use my code posted above, since it would be redundant (the candles would turn light gray if ADX was indicating a choppy market).What does the Cyan/Grey/Yellow bar at the bottom of the chart indicate?
def open_order = bullish[-displace];
def close_order = bearish[-displace];
AddOrder(type = OrderType.BUY_TO_OPEN, open_order, tradeSize = Contracts, tickcolor = Color.GREEN, arrowcolor = Color.GREEN, name = "Long");
AddOrder(type = OrderType.SELL_TO_CLOSE, close_order, tradeSize = Contracts, name = "Close", tickcolor = Color.GRAY, arrowcolor = Color.GRAY);
You were close, name = SHORT needed a " and its not SELL_TO_CLOSE its BUY_TO_CLOSE#Short Order
AddOrder(type = OrderType.SELL_TO_OPEN, close_order, tradeSize = Contracts, tickcolor = Color.RED, arrowcolor = Color.red, name = SHORT");
AddOrder(type = OrderType.SELL_TO_CLOSE, open_order, tradeSize = Contracts, name = "Close short", tickcolor = Color.GRAY, arrowcolor = Color.GRAY);
|Thread starter||Similar threads||Forum||Replies||Date|
|Trend and Momentum Watchlists for ThinkorSwim||Indicators||1|
|EZ Trend and Momentum Indicator for ThinkorSwim||Custom||24|
|RSI in Laguerre Time with Fractal Energy - Momentum/Trend Indicator||Indicators||246|
|Trend Momentum Divergence Indicator for ThinkorSwim||Indicators||2|
|Super Trend + 9 ema + VWAP||Questions||2|