Can coders help with this support/resistance price code?
2 replies
Jason
3 years ago #262623
I have a simple code I have used in ProRealTime that does a really good job of following the support/resistance troughs and peaks of a trending price:
PivotBAR = 4
LookBack = 6
BarLookBack = PivotBAR+1
IF low[PivotBAR] < lowest[LookBack](low)[BarLookBack] THEN
IF low[PivotBAR] = lowest[BarLookBack](low) THEN
ThirdSupportPrice=PrevSupportPrice
PrevSupportPrice=SupportPrice
SupportPrice = low[PivotBAR]
ENDIF
ENDIF
IF high[PivotBAR] > highest[LookBack](high)[BarLookBack] THEN
IF high[PivotBAR] = highest[BarLookBack](high) THEN
ThirdResistancePrice=PrevResistanceprice
PrevResistancePrice=ResistancePrice
ResistancePrice = high[PivotBAR]
ENDIF
ENDIF
return supportprice, resistanceprice
Is this something could be done with algo wizard to create a custom block that would allow the randomisation of pivot bar and look back parameters maybe?
tomas262
3 years ago #266689
Hello,
you need to assign prices to ThirdResistancePrice and other variables so you cannot directly create a custom block for all this.
It is easy to setup a template though that will be used to build new strategies. The parameters can be set to be randomly generated (within pre-define value range)
Check this https://strategyquant.com/doc/strategyquant/strategy-templates/ and this https://strategyquant.com/blog/introduction-strategyquant-templating-system-part/
Jason
3 years ago #266711
Thanks Tomas the links were helpful.
So I put the code together as a template in Algo Wizard as per the code in my original post (short trades only just to start). I’ve attached the file.
However it does not make any trades. I’ve checked the template and looks OK. Maybe its something to do with how SQX assigns the value in ‘Rule 6’?
Viewing 2 replies - 1 through 2 (of 2 total)