I am trying to code a strategy for the slope strategy used by Marty Zweig and Ned Davis on weekly charts
What I am trying to do is to buy if prices rallies, say 5% from a 10-day low
The idea is to reverse and go short if prices decline by 5% from a 10-day high
I coded the ideas as below, but the system is entering buys and sells on the same bar ...
How can I avoid that?
the first consideration would be, if the entries happen at the correct spot i.e. did the same bar actually
decline from the high and advance from the low by X percent?
If that is the case you'd need to decide which order to take.
From your code it appears that orders can be sent as long as the conditions are fulfilled. Is this something you want?
If you have a trend for example and ten consecutive bars that are higher by X percent than the lowest low from 10 bars ago, all of the bars could trigger an entry.
The following user says Thank You to ABCTG for this post: