ProRealTime coding help

Djenser

Newbie
2 0
Hello everyone!

I'm struggling with getting the right syntax for a backtest system i'm creating on ProRealTime. I was hoping to get some help on this forum :)

So in short:
I am only using Bollinger bands for now, on an daily chart,
First things first, so i wanted to first make the code for a "neutral" market (the trending market comes later): the conditions i am using:
Long:
- The low of the candle must have crossed the lower band
- In order to check if the market isn't trending we check the previous high over a timespan of 12 days, and we check if this high have reached the upperband.

Its the same to go Short;)

Now for the question:D : I'm having trouble finding the value of the upper (or lower) band that goes with the previous high/low. I have some ideas, like implementing date and find it that way, but i have no idea how to do this in code! (the method in the code isnt right:cry:)

Code for now:

BollTop = BollingerUp[20](close)
BollDown = BollingerDown[20](close)
PrevHigh = Highest[12](High)
PrevLow = Lowest[12](Low)
PlusPrevHigh = Highest[12](BollingerUp[20](close))
MinPrevLow = Lowest[12](BollingerDown[20](close))

c1 = (Low < BollDown)
c2 = (PrevHigh > PlusPrevHigh)

IF c1 AND c2 THEN
BUY 5 SHARES AT MARKET
ENDIF

c3 = (High > BollTop)
c4 = (PrevLow < MinPrevLow)

IF c3 THEN
SELL AT MARKET
ENDIF

IF c3 AND c4 THEN
SELLSHORT 5 SHARES AT MARKET
ENDIF

IF c1 THEN
EXITSHORT AT MARKET
ENDIF


Sorry for my english;) and don't shoot me if i am in the wrong place of the forum:D

Thanks and have a nice day!(y)
 
 
AdBlock Detected

We get it, advertisements are annoying!

But it's thanks to our sponsors that access to Trade2Win remains free for all. By viewing our ads you help us pay our bills, so please support the site and disable your AdBlocker.

I've Disabled AdBlock