Dow Theory Script

Can I ask…

Has anyone here developed and actively use a Dow Theory buy & sell script?

All the scripts I attempt to use in the back testing module don’t work.


i don’t get it. Why does it feel like the easiest way to backtest is to do it manually. Which takes hours when doing it…


love to know if anyone mastered this yet.

Silence is a good answer here…

Taken as a no one can yet do this…

Mate draw your dow theory pattern using a gann swing chart for me indicating where you want to enter and I will see what I have or can do

Hi Tim & Jonathan,

Sorry to jump on this thread - but I’ve spent a few days trying to write code to get this to work. I think if you filter out all Gann Swing Highs or Lows that are an outside bar with the same trend either side, this will work. My problem is I am new to Optuma and can’t manage to figure out how to do the filter. Would love some help.

I’ve attached 2 images showing a few examples. The Dow Peaks and Troughs are highlighted as a Blue Dot. The Gann Swing High Outside Bars are green arrows and Gann Swing Low Outside Bars are blue arrows. Now I need code to check the following conditions.

Check the Gann Swing Low Outside bar to see if there is an up bar either side of the outside bar (before the previous swing low and future swing high) and the future offset up bar has a higher high than the outside bar.

Similarly, Check the Gann Swing High Outside bar to see if any of the bars are down either side of the outside bar (before the previous swing high & future swing low) and the future offset down bar has a lower low.

Then it may be possible to draw the new Dow Swing chart or filter out these swings high/lows to help identify the Dow Peaks and Troughs. I think it may get more complicated if there are multiple outside bars present for one up or downtrend.

Your thoughts, comments or assistance would be much appreciated.


OK - just realised those conditions wouldn’t always work… See the last example on the first image where there no up bars are present before the swing low and the following outside bar is the trough. But this will be fixed as we can use Gann Swings USECLUSTERS=True.

Hello Jonathan,
How are you going with your scripting journey.

Did you manage to get to the bottom of Dow Theory and Gann Swing show plot and buy and sell signals.