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

MQL5 Converting

Specification

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();

Responded

1
Developer 1
Rating
(36)
Projects
35
40%
Arbitration
12
17% / 50%
Overdue
2
6%
Free
2
Developer 2
Rating
(129)
Projects
208
54%
Arbitration
21
24% / 52%
Overdue
64
31%
Free
3
Developer 3
Rating
(137)
Projects
167
35%
Arbitration
11
91% / 0%
Overdue
0
Free
4
Developer 4
Rating
(547)
Projects
824
73%
Arbitration
15
53% / 13%
Overdue
193
23%
Working
5
Developer 5
Rating
(26)
Projects
23
39%
Arbitration
26
8% / 38%
Overdue
0
Free
6
Developer 6
Rating
(41)
Projects
88
14%
Arbitration
29
31% / 48%
Overdue
36
41%
Loaded
Similar orders
I want to clarify some points, such as: When entering into a buy deal, he opens three deals, each deal has a different take profit and one stop loss. When you look at the code, you will know that there are three take-profit. It opens one deal, taking one profit and adding risk management as well An information screen on the chart shows all the information, I only have $10 for this now, and also I still have more
Witam Szanownych Freelancerów, Mam problem z konwersją strategii EA z MQL4 do MQL5. W zasadzie konwertuje za pomocą skryptu: mq4to5rewrite_sample_v4_2 kończy się sukcesem, ale daje wynik w pliku mq5, który nie daje się skompilować. System występowania o błędach, których ja z braku dostępu do języka MQL nie jest możliwy do zastosowania. W związku z tym mam prośbę o: a) konwersję i przygotowanie pliku żródłowego MQL5
I need someone to convert my Ninjatrader Indicator to Sierrachart, The goal of the indicator is to plot levels on a chart from text or csv inputs. We are trying to plot various levels on Futures. Attached is the txt format we use for Ninja and the csv we created for Sierra. If the file needs to be in a different format we can work on that. What the indicator needs to be able to do is the following: - Plot the levels
Please convert the Pine Script below into MQL4 Indicator: // @version= 5 // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © KivancOzbilgic //created by: @Anil_Ozeksi //developer: ANIL ÖZEKŞİ //author: @kivancozbilgic strategy ( 'Twin Optimized Trend Tracker' , 'TOTT' , overlay = true ) src = input ( close , title = 'Source' ) length = input.int ( 40
hi I have a script in Tradingview that looks good which shows the buy and sell automation. I wanted to see if that can be used in ninja Trader so I converted it for Ninja Trader. But it is not triggering the buy or sell trade like it shows in the tradingview script. Please let me know if you can help me with the script that will work in Ninja Trader just like the one in Trading View. I have the buy and sell signals
I have an indicator that shows green and red bar depending on the market trend. The struggle is not just converting the .mql4 to .mql5 but to have the same calculation and resulting the same view as in the metatrader4 I will share the file in the chat discussion :)
Hello all, I am currently looking for someone that has a telegram copier to copy signals to MT5 and/or MT4. Or also may need customised abit. Will send samples Much help is appreciated Thanks
I have mt4 indicator that is working perfectly but I want to convert it into tradingview strategy. Can I get an expert to get this done for me? I want the strategy to work perfectly on Tradingview
Hello, I am looking for a coder who could translate or convert an MT4 indicator (.mq4 file, source code available) to TradingView's Pine Script. It should be exactly the same indicator, with the same inputs and other settings. Once you complete the job, you will send me the indicator, with full source code for Pine Script. This work will remain confidential. Aslo need to add some extra features to It like visible
I have mt4 indicator that is working perfectly but I want to convert it into tradingview strategy. Can I get an expert to get this done for me? I want the strategy to work perfectly on Tradingview

Project information

Budget
30 - 200 USD
For the developer
27 - 180 USD
Deadline
to 10 day(s)