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

MQL5 Конвертация

Техническое задание

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

Откликнулись

1
Разработчик 1
Оценка
(36)
Проекты
35
40%
Арбитраж
12
17% / 50%
Просрочено
2
6%
Свободен
2
Разработчик 2
Оценка
(129)
Проекты
208
54%
Арбитраж
21
24% / 52%
Просрочено
64
31%
Свободен
3
Разработчик 3
Оценка
(137)
Проекты
167
35%
Арбитраж
11
91% / 0%
Просрочено
0
Свободен
4
Разработчик 4
Оценка
(548)
Проекты
825
73%
Арбитраж
15
53% / 13%
Просрочено
193
23%
Работает
5
Разработчик 5
Оценка
(26)
Проекты
23
39%
Арбитраж
26
8% / 38%
Просрочено
0
Свободен
6
Разработчик 6
Оценка
(41)
Проекты
88
14%
Арбитраж
29
31% / 48%
Просрочено
36
41%
Загружен
Похожие заказы
I need two bots converted from MQL4 to MQL5. They have indicators and order types inside, I will provide the source code etc when agreed. Please message me for more details
Hello. I have 2 indicators from pinescript that I am looking for a conversion to ninjascript. The first indicator is about 60 lines of code. The second indicator is about 100 lines of code. My code is very neat and organized easy to follow. The math and logic in the code *must* be converted exactly or the indicators will be useless
Hello Everyone, In Trading view there is a Script named 'Fibonacci Trend Reversals', I want's the same convert it into MT5 Indicator. The script giving Buy & Sell Signals with 2 Targets as TP1 & TP2, want the same into MT5. Also requires the same Input that the Indicator having, for ref. Screenshots attached
I have a strategy that is based on an indicator that I have in trading view, and I want to automate this strategy for mt4 or mt5. Pls reach out to me of you have the right profession for converting tradingview strategy to metatrader thanks
I have the source file for a FOREX EA that I would like to modify to allow it to trade crypto currencies. It currently gives the error that the currency is not recognized when trying to back test and optimize the EA. Will need the EA to recognize BTC/ETH/SOL pairs and be able to trade crypto currencies
I have a strategy that is based on an indicator that I have in trading view, and I want to automate this strategy for mt4 or mt5. Pls reach out to me of you have the right profession for converting tradingview strategy to metatrader thanks
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
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

Информация о проекте

Бюджет
30 - 200 USD
Исполнителю
27 - 180 USD
Сроки выполнения
до 10 дн.