Stephen Posted June 28, 2018 Report Share Posted June 28, 2018 I have several indicators to trigger buy and sell points. The indicators each use two lines. So when all indicator lines cross in the same direction, it's a buy [or sell]. For example, when a 10 SMA crosses a 20 SMA at the same time as the macd signal crosses the macd main, it could be a buy signal. The problem is that not all lines cross at the same time: the SMA's may cross a candle or two either before or after the macd lines. I'd like to be able to have the alert come up even if the crosses are not on the exact same candle. In the Scan/paintbar editor there is a setting for "candles ago". Does that setting apply to the cross specifically N number of candles ago, or does that setting apply to a cross *within* the last N candles? Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted June 28, 2018 Report Share Posted June 28, 2018 Here's a way to do it. Let's say you want to detect it if within 5 candles at least 2 of 3 crosses happened. You define a FIFOQueue of 15 (5 candles times 3 crosses) capacity. (see https://www.medvedtrader.com/trader/WebHelp/state_keeping.htm - at the bottom of that page - for how to use FIFOQueue in an advanced paintbar or scan) Then what you do is for each cross you add 1 to the queue if it happened and 0 if it didnt. The FIFOQueue's Sum property will tell you the result. If it is more than 2, you trigger. If it is less, you don't. Quote Link to comment Share on other sites More sharing options...
Nagpada Posted October 3, 2018 Report Share Posted October 3, 2018 Got this idea off Tradingview https://www.tradingview.com/symbols/NYSE-GE/technicals/ Maybe you could program similar idea as a composite indicator histogram. Green / yellow / red. Greens line up buy , yellow - no action, red - sell. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.