TradingView Pine Script Breakout Strategy – Problem same bar close
I build a breakout strategy in Pine Script:
Question on how to multiply timeframe logic
I have a strategy script that uses higher timeframes with the current timeframe on the chart. After some backtesting & research, I’ve discovered a mathetimatical pattern with which upper timeframes work with the current timeframes on the chart.
Limit Order Issues Dollar Cost Average Strat Pine Script
I am trying to turn an indicator into a strategy. I have made it to the step where I need to place limit orders so that I can use a dollar cost averaging method for risk management. It places the initial entry order properly. The take profit works properly for both the initial long entry and the DCA orders (when they do actually get placed.) The stop loss for the initial long entry works properly. However, trying to place limit orders with an if statement seems to only work when the strategy isn’t in the initial long position. In addition, I can’t really tell what weird behavior it is, but the dollar cost averaging orders labeled as DCA-1
and DCA-2
are behaving strangely in relation to the entryPrice
. The dca orders almost seem to be using the correct entryPrice
value, but just not executing until after the initial long position has closed (attaching example picture.) I was wondering if somebody could help identify why they are behaving strangely, and why I am not able to place the limit orders correctly?