Help with heikin ashi Algo please
Forums › ProRealTime English forum › ProOrder support › Help with heikin ashi Algo please
- This topic has 5 replies, 4 voices, and was last updated 1 month ago by robertogozzi.
-
-
09/18/2024 at 4:08 PM #237787
Hi there,
I wondered if I could have some help coding an algo idea that I have, I’m trying to get PRT to take a trade on the open of the red candle (with the red arrow) on the attached.
This is the trade entry criteria for the order;
For a short
Close < VWAPclose < close[1]
close[1] > close[2]
close[2] > close[3]
Open = High (No wick on top of candle)Stop = High[1]
Target = 2 x StopAny help would be greatly appreciated.
AH
09/18/2024 at 4:57 PM #237792Your screenshot doesn’t seem to have HA candlesticks plotted?
Here is the code using HA candlesticks:
123456789101112131415161718192021once xOpen = openxClose = (open + close + high + low) / 4if barindex > 0 thenxOpen = (xOpen[1] + xClose[1]) / 2endif//xLow = min(low,min(xClose,xOpen))xHigh = max(high,max(xClose,xOpen))myVWAP, my1, my11, my2, my21, my3, my31 = CALL "VWAP - SMF"c1 = xClose < myVwapc2 = xClose < xClose[1]c3 = xClose[1] > xClose[2]c4 = xClose[2] > xClose[3]c5 = xOpen = xHighCond = c1 AND c2 AND c3 AND c4 AND c5 AND Not OnMarketSL = xHigh[1]TP = SL * 2IF Cond THENSELLSHORT 1 CONTRACT AT MARKETSET STOP PRICE SLSET TARGET PRICE TPENDIF09/18/2024 at 6:52 PM #23779509/19/2024 at 9:43 AM #237808First of all I noticed a bug in the code, regarding the TP calculations. This is the amended code:
123456789101112131415161718192021once xOpen = openxClose = (open + close + high + low) / 4if barindex > 0 thenxOpen = (xOpen[1] + xClose[1]) / 2endif//xLow = min(low,min(xClose,xOpen))xHigh = max(high,max(xClose,xOpen))myVWAP, my1, my11, my2, my21, my3, my31 = CALL "VWAP - SMF"c1 = xClose < myVwapc2 = xClose < xClose[1]c3 = xClose[1] > xClose[2]c4 = xClose[2] > xClose[3]c5 = xOpen = xHighCond = c1 AND c2 AND c3 AND c4 AND c5 AND Not OnMarketSL = xHigh[1]TP = xClose - (abs(xClose - SL) * 2)IF Cond THENSELLSHORT 1 CONTRACT AT MARKETSET STOP PRICE SLSET TARGET PRICE TPENDIFthen here is the code with both entries:
1234567891011121314151617181920212223242526272829303132333435363738394041once xOpen = openxClose = (open + close + high + low) / 4if barindex > 0 thenxOpen = (xOpen[1] + xClose[1]) / 2endifxLow = min(low,min(xClose,xOpen))xHigh = max(high,max(xClose,xOpen))myVWAP, my1, my11, my2, my21, my3, my31 = CALL "VWAP - SMF"//b1 = xClose > myVwapb2 = xClose > xClose[1]b3 = xClose[1] < xClose[2]b4 = xClose[2] < xClose[3]b5 = (xOpen = xLow)//c1 = xClose < myVwapc2 = xClose < xClose[1]c3 = xClose[1] > xClose[2]c4 = xClose[2] > xClose[3]c5 = (xOpen = xHigh)//CondB = b1 AND b2 AND b3 AND b4 AND b5 AND Not OnMarket //LongOnMarket for S&RCondC = c1 AND c2 AND c3 AND c4 AND c5 AND Not OnMarket //ShortOnMarket for S&R//IF CondB THENBUY 1 CONTRACT AT MARKETSL = xLow[1]TP = xClose + (abs(xClose - SL) * 2)SET STOP PRICE SLSET TARGET PRICE TPENDIF//IF CondC THENSELLSHORT 1 CONTRACT AT MARKETSL = xHigh[1]TP = xClose - (abs(xClose - SL) * 2)SET STOP PRICE SLSET TARGET PRICE TPENDIF//graphonprice SL coloured("Red")//graphonprice TP coloured("Blue")1 user thanked author for this post.
09/21/2024 at 2:54 PM #23790709/22/2024 at 12:30 AM #237914Yes, I used the f symbol to automatically insert the CALL instruction and the code of the indicator was not visible as it’s a built-in proprietary code.
In any case a different VWAP indicator can be used, despite some differences in the returned data. But VWAP is almost impossible to replicate exactly.
Just CALL another one.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on