Hi,
As Constant Volume candles are not available for ProOrder, i tried to work on a code to develop an indicator that could be used to place orders through a ProOrder Strategy. However, i couldn’t make it work.
It seems to not display the candles properly, therefore i must make mistake in the candles parameters calculations but i can’t find the solution.
Here is the draft i started, can anyone help me to make that work properly ?
Thanks a lot in advance !
// Paramètres de l'indicateur
volumeSeuil = 10000 // Volume seuil pour chaque bougie
// Variables
cumulVolume = 0 // Cumul du volume
debutBougie = UNDEFINED // Début de la bougie à volume constant
bougieEnCours = 0 // Indicateur si une bougie est en cours de formation (0 pour non, 1 pour oui)
openBougie = 0
highBougie = 0
lowBougie = 0
closeBougie = 0
// Calcul des bougies à volume constant
FOR i = 0 TO BarIndex
cumulVolume = cumulVolume + volume[i]
IF cumulVolume >= volumeSeuil THEN
IF debutBougie = UNDEFINED THEN
debutBougie = i
openBougie = open[i]
highBougie = high[i]
lowBougie = low[i]
ELSE
highBougie = MAX(highBougie, high[i])
lowBougie = MIN(lowBougie, low[i])
ENDIF
closeBougie = close[i]
bougieEnCours = 1
ENDIF
IF bougieEnCours = 1 AND (cumulVolume >= volumeSeuil OR i = BarIndex) THEN
// Affichage de la bougie
DRAWCANDLE(openBougie, highBougie, lowBougie, closeBougie) COLOURED (255, 0, 0)
// Réinitialisation pour la prochaine bougie
debutBougie = UNDEFINED
cumulVolume = 0
bougieEnCours = 0
// Réinitialiser highBougie et lowBougie pour la prochaine bougie
highBougie = UNDEFINED
lowBougie = UNDEFINED
ENDIF
NEXT
RETURN
JSParticipant
Senior
Hi @Fabienmi,
I think the “Constant Volume Candles” are present in PRT, because you have the option to select a time frame which is not based on time but on (equal) volumes…
Go to “TimeFrame” in your graph and select “10k volumes”…
Hi JS,
Yes i actually already use that for manual trading. The reason for this indicator is that auto trading doesn’t work with constant volume candle, so i need to rebuild an indicator to make it work.
JSParticipant
Senior
Hi Fabien,
That’s right, the non-time related timeframes don’t work with pro-order…
Do you think your indicator will work with pro-order…?
(A “good” indicator for this will have to be based on “tick-data” which is also not time related…)
I have tried it before and it works.
In your chart, e.g. open nas chart with 12500 volume candles, then backtest/deploy your algo, it will run on that. At least it used to before.
Please ignore my post, it isn’t working
As far as I know, it’s impossible to reproduce this constant volume indicator using a linear unit of time, which is the only choice available in autotrading.
It is the principle of this indicator to be dependent only on volume and not on time.