bonjour,
je souhaite traduire un code déjà existant dans un autre langage de programmation en langage prorbuilder afin de l’exploiter sur la plateforme prorealtime. Sachant que le programme en question était écrit par monsieur Eric LEFORt en langage expres de nano trader.
merci d’avance
Il serait utile que vous fournissiez plus d'informations, telles que des images de l'indicateur.
Bonjour et merci Ivan,
Dans ce message je vous envoie un lien direct pour une vidéo explicative ainsi qu’un lien pour le site de mogalef trading, les deux fichiers texte du programme ainsi que le pfd contenant tous les détails et illustrations concernant la stratégie en question. J’aimerais vraiment implémenter cette stratégie sur proréaltime , plat-forme, sur lequel je commence à travailler.
Voici les annexes :
- Lien vers le site Mongalef Traing :
https://www.mogalef-trading.com/
- Lien vers la vidéo explicative des bandes de Mogalef :
https://www.youtube.com/watch?v=y6NHdN8vPMU
- Capture_écran sur la page de site ;
- Le fichier pdf explicatif détaillé des bandes de Mogalef :
Bandes mogalef 2023.pdf « Comme le fichier est trop volumineux je ne peux pas l’attacher, vous le retrouverai facilement sur le site de mongalef-trading et dont je vous envoie le lien aisi qu’un fichier de capture d’écran du site en question ;
- Fichier texte du programme bandes de Mogalef en language Expres de nano-tader : EL_MOGALEF_Bands_2023 ;
- Fichier Texte du programme Mogalef Stop :
EL_MOGALEF_STOP_V2023.
Je tiens à vous remercier de bien vouloir m’aider pour traduire cette stratégie en probuilder pour pouvoir l’exploiter sur proréaltime.
Merci d’avance.
ici vous avez le code :
//-------------------------------------------------//
//PRC_Mogalef Bands
//version = 0
//15.05.24
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//-------------------------------------------------//
//-----Inputs--------------------------------------//
N = 4 // Number of periods for linear regression, adjustable from 2 to 10
ET = 7 // Number of periods for standard deviation, adjustable from 5 to 15
coef = 2 // Coefficient for the bands, adjustable from 1 to 7
//-------------------------------------------------//
X = BarIndex // Index of the current bar
Y = (high + low + open + 2*close) / 5 / TickSize // Weighted average price calculation
//-------------------------------------------------//
if x <= n-1 then
sumx = sumx + x // Summing up indices for the regression calculation
sumy = sumy + y // Summing up weighted prices for the regression calculation
mogreglin = close // Setting the initial value of the regression line to the current close
if x = n-1 then
sumx2 = n * (pow(n, 2) - 1) / 12 // Pre-calculating part of the denominator for the regression slope
for j = 0 to n-1 do
ssumxy = ssumxy + (n * x[j] - sumx) * (n * y[j] - sumy) // Sum of products of deviations for slope
next
sumxy = ssumxy / pow(n, 2) // Final computation of covariance
avgx = sumx / n // Average of x-values
avgy = sumy / n // Average of y-values
b = sumxy / sumx2 // Slope of the regression line
a = avgy - b * avgx // Intercept of the regression line
mogreglin = (a + b * x) * ticksize // Calculation of the linear regression value
endif
else
sumx = sumx + x - x[n] // Adjusting sumx to include only the last n points
sumy = sumy + y - y[n] // Adjusting sumy to include only the last n points
ssumxy = ssumxy + (n * x - sumx) * (n * y - sumy) - (n * x[n] - sumx) * (n * y[n] - sumy) + n * (x - x[n]) * (y - y[n])
sumxy = ssumxy / pow(n, 2) // Recalculate covariance for updated points
avgx = sumx / n // Recompute the average of x-values
avgy = sumy / n // Recompute the average of y-values
b = sumxy / sumx2 // Recompute the slope of the regression line
a = avgy - b * avgx // Recompute the intercept
mogreglin = (a + b * x) * ticksize // Update the regression line value
endif
//-------------------------------------------------//
etyp = std[et](mogreglin) // Standard deviation of the regression line over ET periods
//-------------------------------------------------//
if mogreglin < mogh[1] and mogreglin > mogb[1] then
mogh = mogh[1] // Hold previous high if within the bounds
mogb = mogb[1] // Hold previous low if within the bounds
mogm = mogm[1] // Maintain previous midline
else
mogh = mogreglin + etyp * coef // Calculate new upper band
mogb = mogreglin - etyp * coef // Calculate new lower band
mogm = mogreglin // Update the midline
endif
//-------------------------------------------------//
colorbetween(mogh, mogm, "green", 35) // Color area between high and midline green
colorbetween(mogb, mogm, "red", 35) // Color area between low and midline red
//-------------------------------------------------//
RETURN MogH as "Mogalef High" coloured("yellow")style(line,2), MogM as "Mogalef Mid"coloured("blue")style(line,2), MogB as "Mogalef Low"coloured("green")style(line,2)