Converting the following indicator from Amibroker AFL to either MQ4 or MQL5.

MQL5 Conversión

Tarea técnica

Hi friends,

I am very new to trading. Someone kindly help me converting the following indicator from Amibroker AFL to either MQ4 or MQL5. I found it on internet. Could not find Simon who coded it originally but big thanks to him.

Thanks in advance.

//--------- CPR ---------//
//Coded By: SIMSON//

_SECTION_BEGIN( "CPR" );
dtDayStartComp = TimeFrameCompress( DateTime(), inDaily, compressOpen );
dtDayStartExp = TimeFrameExpand( dtDayStartComp, inDaily, expandFirst );
dtDayEndComp = TimeFrameCompress( DateTime(), inDaily, compressLast );
dtDayEndExp = TimeFrameExpand( dtDayEndComp, inDaily, expandFirst );
DayCond = DateTime() >= dtDayStartExp AND DateTime() < dtDayEndExp;

//Levels Settings (Shown / Hidden)//
/*
DCPR = ParamToggle( "Daily CPR", "Shown|Hidden", 0 );
WCPR = ParamToggle( "Weekly CPR", "Shown|Hidden", 0 );
MCPR = ParamToggle( "Monthly CPR", "Shown|Hidden", 0 );
*/
TCPR = ParamToggle( "Tomorrow CPR", "Shown|Hidden", 1 );

DRE4 = ParamToggle( "Daily R4", "Shown|Hidden", 1 );
DRE3 = ParamToggle( "Daily R3", "Shown|Hidden", 1 );
DRE2 = ParamToggle( "Daily R2", "Shown|Hidden", 1 );
DRE1 = ParamToggle( "Daily R1", "Shown|Hidden", 0 );
DCUB = ParamToggle( "Daily UB", "Shown|Hidden", 0 );
DCPV = ParamToggle( "Daily PV", "Shown|Hidden", 0 );
DCLB = ParamToggle( "Daily LB", "Shown|Hidden", 0 );
DSU1 = ParamToggle( "Daily S1", "Shown|Hidden", 0 );
DSU2 = ParamToggle( "Daily S2", "Shown|Hidden", 1 );
DSU3 = ParamToggle( "Daily S3", "Shown|Hidden", 1 );
DSU4 = ParamToggle( "Daily S4", "Shown|Hidden", 1 );
DH = ParamToggle( "Previous Day High", "Shown|Hidden", 0 );
DL = ParamToggle( "Previous Day Low", "Shown|Hidden", 0 );

WRE3 = ParamToggle( "Weekly R3", "Shown|Hidden", 1 );
WRE2 = ParamToggle( "Weekly R2", "Shown|Hidden", 1 );
WRE1 = ParamToggle( "Weekly R1", "Shown|Hidden", 1 );
WCUB = ParamToggle( "Weekly UB", "Shown|Hidden", 1 );
WCPV = ParamToggle( "Weekly PV", "Shown|Hidden", 1 );
WCLB = ParamToggle( "Weekly LB", "Shown|Hidden", 1 );
WSU1 = ParamToggle( "Weekly S1", "Shown|Hidden", 1 );
WSU2 = ParamToggle( "Weekly S2", "Shown|Hidden", 1 );
WSU3 = ParamToggle( "Weekly S3", "Shown|Hidden", 1 );
WH = ParamToggle( "Previous Week High", "Shown|Hidden", 1 );
WL = ParamToggle( "Previous Week Low", "Shown|Hidden", 1 );

MRE3 = ParamToggle( "Monttly R3", "Shown|Hidden", 1 );
MRE2 = ParamToggle( "Monttly R2", "Shown|Hidden", 1 );
MRE1 = ParamToggle( "Monttly R1", "Shown|Hidden", 1 );
MCUB = ParamToggle( "Monttly UB", "Shown|Hidden", 1 );
MCPV = ParamToggle( "Monttly PV", "Shown|Hidden", 1 );
MCLB = ParamToggle( "Monttly LB", "Shown|Hidden", 1 );
MSU1 = ParamToggle( "Monttly S1", "Shown|Hidden", 1 );
MSU2 = ParamToggle( "Monttly S2", "Shown|Hidden", 1 );
MSU3 = ParamToggle( "Monttly S3", "Shown|Hidden", 1 );
MH = ParamToggle( "Previous Month High", "Shown|Hidden", 1 );
ML = ParamToggle( "Previous Month Low", "Shown|Hidden", 1 );

// Current Day High Low Close
CDH = TimeFrameGetPrice( "H", inDaily, 0 );
CDL = TimeFrameGetPrice( "L", inDaily, 0 );
CDC = TimeFrameGetPrice( "C", inDaily, 0 );
// Previous Days High Low Close
PDH = TimeFrameGetPrice( "H", inDaily, -1 );
PDL = TimeFrameGetPrice( "L", inDaily, -1 );
PDC = TimeFrameGetPrice( "C", inDaily, -1 );
// Previous Weeks High Low Close
PWH = TimeFrameGetPrice( "H", inWeekly, -1 );
PWL = TimeFrameGetPrice( "L", inWeekly, -1 );
PWC = TimeFrameGetPrice( "C", inWeekly, -1 );
// Previous Months High Low Close
PMH = TimeFrameGetPrice( "H", inMonthly, -1 );
PML = TimeFrameGetPrice( "L", inMonthly, -1 );
PMC = TimeFrameGetPrice( "C", inMonthly, -1 );
// Daily CPR
PV = ( PDH + PDL + PDC ) / 3;
LB = ( PDH + PDL ) / 2;
UB = ( PV - LB ) + PV ;
// Weekly CPR
WPV = ( PWH + PWL + PWC ) / 3;
WLB = ( PWH + PWL ) / 2;
WUB = ( WPV - WLB ) + WPV;
// Monthly CPR
MPV = ( PMH + PML + PMC ) / 3;
MLB = ( PMH + PML ) / 2;
MUB = ( MPV - MLB ) + MPV;
// Daily Resistence & Supports
R1 = 2 * PV - PDL;
R2 = PV + ( PDH - PDL );
R3 = R1 + ( PDH - PDL );
R4 = R3 + ( R2 - R1);
S1 = 2 * PV - PDH;
S2 = PV - ( PDH - PDL );
S3 = S1 - ( PDH - PDL );
S4 = S3 - ( S1 - S2 );
// Weekly Resistence & Supports
WR1 = 2 * WPV - PWL;
WR2 = WPV + ( PWH - PWL );
WR3 = WR1 + ( PWH - PWL );
WR4 = WR3 + ( WR2 - WR1);
WS1 = 2 * WPV - PWH;
WS2 = WPV - ( PWH - PWL );
WS3 = WS1 - ( PWH - PWL );
WS4 = WS3 - ( WS1 - WS2 );
// Monthly Resistence & Supports
MR1 = 2 * MPV - PML;
MR2 = MPV + ( PMH - PML );
MR3 = MR1 + ( PDH - PML );
MR4 = MR3 + ( MR2 - MR1);
MS1 = 2 * MPV - PMH;
MS2 = MPV - ( PMH - PML );
MS3 = MS1 - ( PMH - PML );
MS4 = MS3 - ( MS1 - MS2 );

numbars = LastValue( Cum( Status( "barvisible" ) ) );
hts = -50;

_SECTION_BEGIN( "DAILY CPR" );
if ( DH == 0 )
{
Plot( IIf( DayCond, PDH, Null ), "PDH", colorYellow, styleLine, Null, Null, 2 );
PlotText( "PDH = "+PDH , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(PDH), colorYellow );
}
if ( DL == 0 )
{
Plot( IIf( DayCond, PDL, Null ), "PDL", colorYellow, styleLine, Null, Null, 2 );
PlotText( "PDL = "+PDL , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(PDL), colorYellow );
}
if ( DCUB == 0 )
{
Plot( IIf( DayCond, UB, Null ), "UB", colorAqua, styleLine, Null, Null, 2 );
PlotText( "UB = "+UB , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(UB), colorAqua );
}
if ( DCPV == 0 )
{
Plot( IIf( DayCond, PV, Null ), "Pivot", colorAqua, styleLine, Null, Null, 2 );
PlotText( "PV = "+PV , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(PV), colorAqua );
}
if ( DCLB == 0 )
{
Plot( IIf( DayCond, LB, Null ), "LB", colorAqua, styleLine, Null, Null, 2 );
PlotText( "LB = "+LB , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(LB), colorAqua );
}

if ( DRE1 == 0 )
{
Plot( IIf( DayCond, R1, Null ), "R1", colorLime, styleLine, Null, Null, 2 );
PlotText( "R1 = "+R1 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(R1), colorLime );
}
if ( DRE2 == 0 )
{
Plot( IIf( DayCond, R2, Null ), "R2", colorLime, styleLine, Null, Null, 2 );
PlotText( "R2 = "+R2 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(R2), colorLime );
}
if ( DRE3 == 0 )
{
Plot( IIf( DayCond, R3, Null ), "R3", colorLime, styleLine, Null, Null, 2 );
PlotText( "R3 = "+R3 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(R3), colorLime );
}
if ( DRE4 == 0 )
{
Plot( IIf( DayCond, R4, Null ), "R4", colorLime, styleLine, Null, Null, 2 );
PlotText( "R4 = "+R4 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(R4), colorLime );
}
if ( DSU1 == 0 )
{
Plot( IIf( DayCond, S1, Null ), "S1", colorOrange, styleLine, Null, Null, 2 );
PlotText( "S1 = "+S1 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(S1), colorOrange );
}
if ( DSU2 == 0 )
{
Plot( IIf( DayCond, S2, Null ), "S2", colorOrange, styleLine, Null, Null, 2 );
PlotText( "S2 = "+S2 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(S2), colorOrange );
}
if ( DSU3 == 0 )
{
Plot( IIf( DayCond, S3, Null ), "S3", colorOrange, styleLine, Null, Null, 2 );
PlotText( "S3 = "+S3 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(S3), colorOrange );
}
if ( DSU4 == 0 )
{
Plot( IIf( DayCond, S4, Null ), "S4", colorOrange, styleLine, Null, Null, 2 );
PlotText( "S4 = "+S4 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(S4), colorOrange );
}
_SECTION_END();

_SECTION_BEGIN( "WEEKLY CPR" );
if ( WH == 0 )
{
Plot( IIf( DayCond, PWH, Null ), "PWH", colorYellow, styleLine, Null, Null, 2 );
PlotText( "PWH = "+PWH , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(PWH), colorYellow );
}
if ( WL == 0 )
{
Plot( IIf( DayCond, PWL, Null ), "PWL", colorYellow, styleLine, Null, Null, 2 );
PlotText( "PWL = "+PWL , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(PWL), colorYellow );
}
if ( WCUB == 0 )
{
Plot( IIf( DayCond, WUB, Null ), "WCUB", colorAqua, styleDots, Null, Null, 2 );
PlotText( "WCUB = "+WUB , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(WUB), colorAqua );
}
if ( WCPV == 0 )
{
Plot( IIf( DayCond, WPV, Null ), "WCPV", colorAqua, styleDots, Null, Null, 2 );
PlotText( "WCPV = "+WPV , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(WPV), colorAqua );
}
if ( WCLB == 0 )
{
Plot( IIf( DayCond, WLB, Null ), "WCLB", colorAqua, styleDots, Null, Null, 2 );
PlotText( "WCLB = "+WLB , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(WLB), colorAqua );
}

if ( WRE1 == 0 )
{
Plot( IIf( DayCond, WR1, Null ), "WR1", colorLime, styleDots, Null, Null, 2 );
PlotText( "WR1 = "+WR1 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(WR1), colorLime );
}
if ( WRE2 == 0 )
{
Plot( IIf( DayCond, WR2, Null ), "WR2", colorLime, styleDots, Null, Null, 2 );
PlotText( "WR2 = "+WR2 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(WR2), colorLime );
}
if ( WRE3 == 0 )
{
Plot( IIf( DayCond, WR3, Null ), "WR3", colorLime, styleDots, Null, Null, 2 );
PlotText( "WR3 = "+WR3 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(WR3), colorLime );
}
if ( WSU1 == 0 )
{
Plot( IIf( DayCond, WS1, Null ), "WS1", colorOrange, styleDots, Null, Null, 2 );
PlotText( "WS1 = "+WS1 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(WS1), colorOrange );
}
if ( WSU2 == 0 )
{
Plot( IIf( DayCond, WS2, Null ), "WS2", colorOrange, styleDots, Null, Null, 2 );
PlotText( "WS2 = "+WS2 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(WS2), colorOrange );
}
if ( WSU3 == 0 )
{
Plot( IIf( DayCond, WS3, Null ), "WS3", colorOrange, styleDots, Null, Null, 2 );
PlotText( "WS3 = "+WS3 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(WS3), colorOrange );
}
_SECTION_END();

_SECTION_BEGIN( "MONTHLY CPR" );
if ( MH == 0 )
{
Plot( IIf( DayCond, PMH, Null ), "PMH", colorYellow, styleLine, Null, Null, 2 );
PlotText( "PMH = "+PMH , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(PMH), colorYellow );
}
if ( ML == 0 )
{
Plot( IIf( DayCond, PML, Null ), "PML", colorYellow, styleLine, Null, Null, 2 );
PlotText( "PML = "+PML , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(PML), colorYellow );
}
if ( MCUB == 0 )
{
Plot( IIf( DayCond, MUB, Null ), "MCUB", colorAqua, styleDashed, Null, Null, 2 );
PlotText( "MCUB = "+MUB , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(MUB), colorAqua );
}
if ( MCPV == 0 )
{
Plot( IIf( DayCond, MPV, Null ), "MCPV", colorAqua, styleDashed, Null, Null, 2 );
PlotText( "MCPV = "+MPV , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(MPV), colorAqua );
}
if ( MCLB == 0 )
{
Plot( IIf( DayCond, MLB, Null ), "MCLB", colorAqua, styleDashed, Null, Null, 2 );
PlotText( "MCLB = "+MLB , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(MLB), colorAqua );
}

if ( MRE1 == 0 )
{
Plot( IIf( DayCond, MR1, Null ), "MR1", colorLime, styleDashed, Null, Null, 2 );
PlotText( "MR1 = "+MR1 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(MR1), colorLime );
}
if ( MRE2 == 0 )
{
Plot( IIf( DayCond, MR2, Null ), "MR2", colorLime, styleDashed, Null, Null, 2 );
PlotText( "MR2 = "+MR2 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(MR2), colorLime );
}
if ( MRE3 == 0 )
{
Plot( IIf( DayCond, MR3, Null ), "MR3", colorLime, styleDashed, Null, Null, 2 );
PlotText( "MR3 = "+MR3 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(MR3), colorLime );
}
if ( MSU1 == 0 )
{
Plot( IIf( DayCond, MS1, Null ), "MS1", colorOrange, styleDashed, Null, Null, 2 );
PlotText( "MS1 = "+MS1 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(MS1), colorOrange );
}
if ( MSU2 == 0 )
{
Plot( IIf( DayCond, MS2, Null ), "MS2", colorOrange, styleDashed, Null, Null, 2 );
PlotText( "MS2 = "+MS2 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(MS2), colorOrange );
}
if ( MSU3 == 0 )
{
Plot( IIf( DayCond, MS3, Null ), "MS3", colorOrange, styleDashed, Null, Null, 2 );
PlotText( "MS3 = "+MS3 , LastValue( BarIndex() ) - ( numbars / Hts ), LastValue(MS3), colorOrange );
}
_SECTION_END();

_SECTION_END();

_SECTION_BEGIN( "NEXT DAY" );
if ( TCPR == 0 )
{
shift = 10; //Number of Bars to be shifted, could use a Param if needed
bi = BarIndex();
lvbi = LastValue( bi );
LAx0 = lvbi - shift + 1;
LAx1 = lvbi;

// Present Days High Low Close
// These levels will be dynamic as day progresses and would ahow up in the no bar region after the last visible Bar for shifted number of bars (i.e. 10 in this case)
// Do use "Bar Replay" to figure out what I mean
dH = TimeFrameGetPrice( "H", inDaily, 0 );
dL = TimeFrameGetPrice( "L", inDaily, 0 );
dC = TimeFrameGetPrice( "C", inDaily, 0 );

//Central Pivots shifted for Next Day
dPV = ( dH + dL + dC ) / 3;
LB = ( dH + dL ) / 2;
UB = 2 * dPV - LB;

y = LastValue( dPV );
la = LineArray( LAx0, y, LAx1, y );
Plot( la, "PV", colorAqua, styleThick, Null, Null, shift );

y = LastValue( LB );
la = LineArray( LAx0, y, LAx1, y );
Plot( la, "LB", colorAqua, styleThick, Null, Null, shift );

y = LastValue( UB );
la = LineArray( LAx0, y, LAx1, y );
Plot( la, "UB", colorAqua, styleThick, Null, Null, shift );

//Pivot Levels shifted for Next Day
R1 = 2 * dPV - dL;
R2 = dPV + dH - dL;
S1 = 2 * dPV - dH;
S2 = dPV - dH + dL;

y = LastValue( R1 );
la = LineArray( LAx0, y, LAx1, y );
Plot( la, "R1", colorOrange, styleThick, Null, Null, shift );

y = LastValue( R2 );
la = LineArray( LAx0, y, LAx1, y );
Plot( la, "R2", colorOrange, styleThick, Null, Null, shift );

y = LastValue( S1 );
la = LineArray( LAx0, y, LAx1, y );
Plot( la, "S1", colorLime, styleThick, Null, Null, shift );

y = LastValue( S2 );
la = LineArray( LAx0, y, LAx1, y );
Plot( la, "S2", colorLime, styleThick, Null, Null, shift );
}
_SECTION_END();

Han respondido

1
Desarrollador 1
Evaluación
(36)
Proyectos
35
40%
Arbitraje
12
17% / 50%
Caducado
2
6%
Libre
2
Desarrollador 2
Evaluación
(129)
Proyectos
208
54%
Arbitraje
21
24% / 52%
Caducado
64
31%
Libre
3
Desarrollador 3
Evaluación
(137)
Proyectos
167
35%
Arbitraje
11
91% / 0%
Caducado
0
Libre
4
Desarrollador 4
Evaluación
(548)
Proyectos
825
73%
Arbitraje
15
53% / 13%
Caducado
193
23%
Trabaja
5
Desarrollador 5
Evaluación
(26)
Proyectos
23
39%
Arbitraje
26
8% / 38%
Caducado
0
Libre
6
Desarrollador 6
Evaluación
(41)
Proyectos
88
14%
Arbitraje
29
31% / 55%
Caducado
36
41%
Trabaja
Solicitudes similares
Attached to this post is the pinescript tradingview indicator code, i will also attach a link to the youtube explanatory video of how the indicator works on tradingview, i will like the exact thing on mt5, including the percentage prediction on each bar and the win loss counter ... it should work on both forex, stock and volatility indices on mt5 https://youtu.be/30FLWyEWroM?si=q9GpvJVHp-oyvsvZ // This work is
I have running ea on mt4 and I have code of it. Can you convert to mt5. When you agree then I will share the code. If you can add more code to optimize then more better
I have a thinkorswim indicator that I'd like to convert to trading view. Is anyone here that can help me with! Do you need to know anything details about this project before you could see if it's something you can do ? Send a DM and let me share with you my scrip
i have a custom indicator that i want to convert to expert adviser. it does not use stoploss it add pending orders that can be deleted i dont have much budget but i can connect you with who had
Hey, I would like an indicator based on calculation with the last price, sort of fib. The lines will auto update based on actual price. I want you to create 3x this block(of line), lines positions will be diferent as the multiplier of the 3 blocks will not be the same. I want you to create a signal based on the price that will be at the same zone(inside 2 lines) in 3 blocks at same time. check the intruction.txt
The bot must be able to do bulk operations with automatic sl and tp...it also has to leverage trades add more as the trades are in profits...it has to be...it has to specifically trade Nas100 us30 and gold...only...and it may use be able to trade on a bonus50% account or standard
Необходимо конвертировать индикатор в Mql5. Индикатор должен индентично работать иметь тот же функционал. Ссылка на индикатор . Я планирую конвертировать 5 индикаторов в общей сложности. Надеюсь на долгосрочное сотрудничество
Hello freelancers here, I need an expert freelancer to help me convert an expert advisor from MT4 to MT5. I have the MT4 source code, As for now i only got $15 for this project i don't have much on me at the moment, So i need someone who can work long terms cause i still have other projects i need him to work on for me
I want to convert my tradingview indicator to mt5 indicator .. I want the mt5 indicator to be same with how the tradingview is . No addition no subtraction. Must be same with tradingview for mt5 indicator
Hey I need a pinescript coder to convert Tradingview PINESCRIPT to Metatrader 5, I have the script on tradingview and I will be eligible to share this with you via comment section I need a proficient individual who is able to make a good conversion to tradingview indicator without any errors code/bugs, make the code run perfectly as expected, please reach out if you can do this thanks

Información sobre el proyecto

Presupuesto
30 - 200 USD
Para el ejecutor
27 - 180 USD
Plazo límite de ejecución
a 10 día(s)