Sao Paulo, Sao Paulo/Brazil
Posts: 11 since Sep 2015
Thanks Given: 10
Thanks Received: 1
|
Hi,
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?
Tks,
Inputs:
Length (10),
BuySignal (0.05),
SellSignal (-0.05);
If (Close/Lowest(Low[1], Length)-1) > BuySignal then buy next bar at market;
If (Close/Highest(High[1], Length)-1) < SellSignal then sellshort next bar at Market;
|