• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 3:52am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 3:52am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

How can I convert .ex4 file into .mq4? 138 replies

Need Help converting AFL Amibroker to MQ4 Metatrader 4 replies

Please help convert this to MQ4 file. Thank you! 8 replies

MetaTrader 4, mq4 File to Esignal EFS File 0 replies

how to include a file.txt in an mq4 file ?? 6 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 8
Attachments: Convert afl file to mq4 file
Exit Attachments

Convert afl file to mq4 file

  • Last Post
  •  
  • Page 1 2
  • Page 1 2
  •  
  • Post #1
  • Quote
  • First Post: Jul 8, 2012 11:45am Jul 8, 2012 11:45am
  •  ForexTeam
  • | Joined Feb 2012 | Status: Member | 74 Posts
Hi !

I want to ask if someone could help me to convert an afl (Amibroker) into a mq4 file ? I'm using MT4 for this reason I want to transform this file.
Thank you.
  • Post #2
  • Quote
  • Jul 8, 2012 1:16pm Jul 8, 2012 1:16pm
  •  jimmybeans
  • | Membership Revoked | Joined Jun 2012 | 94 Posts
Quoting ForexTeam
Disliked
Hi !

I want to ask if someone could help me to convert an afl (Amibroker) into a mq4 file ? I'm using MT4 for this reason I want to transform this file.
Thank you.
Ignored
not having ever dealt with any afl code before, i dont really know what i am talking about, but i am confident that some will ask if you have the source code or not?

if you do, it shouldnt be too terribly difficult to translate it by hand, tho that will depend on how complex your afl code is.

http://www.amibroker.com/guide/tutorial.html

even if somebody isnt even entirely fluent in writing afl code, it should be fairly straight forward to read the afl code and figure out what it does and then just write it from scratch in metatrader.

and another question that will probably be asked is why are you making this change from afl code at amibroker to the metatrader platform?

z/.
 
 
  • Post #3
  • Quote
  • Edited at 3:54pm Jul 8, 2012 3:28pm | Edited at 3:54pm
  •  ForexTeam
  • | Joined Feb 2012 | Status: Member | 74 Posts
Hi !

I have the code, the file. It's a good indicator, that could be also improved.
I'm using Metatrader 4, that's why I need that file into mq4. I'm not a programmer, I hope to find someone to help me.

Thank you, for answer.

Quoting jimmybeans
Disliked
not having ever dealt with any afl code before, i dont really know what i am talking about, but i am confident that some will ask if you have the source code or not?

if you do, it shouldnt be too terribly difficult to translate it by hand, tho that will depend on how complex your afl code is.

http://www.amibroker.com/guide/tutorial.html

even if somebody isnt even entirely fluent in writing afl code, it should be fairly straight forward to read the afl code and figure out what it does and then just write it from scratch in metatrader....
Ignored
 
 
  • Post #4
  • Quote
  • Jul 9, 2012 1:44am Jul 9, 2012 1:44am
  •  mtuppers
  • | Joined Mar 2007 | Status: Member | 397 Posts
Quoting ForexTeam
Disliked
Hi !

I have the code, the file. It's a good indicator, that could be also improved.
I'm using Metatrader 4, that's why I need that file into mq4. I'm not a programmer, I hope to find someone to help me.

Thank you, for answer.
Ignored
post your indicator for other to try, or you might want go to another forum to ask
 
 
  • Post #5
  • Quote
  • Jul 22, 2012 7:17am Jul 22, 2012 7:17am
  •  ForexTeam
  • | Joined Feb 2012 | Status: Member | 74 Posts
http://www.traderji.com/advanced-tra...lines-afl.html

And this is the code:

///////////////////////////////////////////////////////////////////////////////////////////
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} ,{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot(C, "", IIf(O>=C, colorOrange, colorGreen),styleCandle);

SetChartBkGradientFill( ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack));
_N(Title = EncodeColor(colorWhite)+StrFormat(" {{NAME}} - {{INTERVAL}} {{DATE}} Open:%g, Close:%g ,{{VALUES}}",O,C ));

/////////////////////////////////////////////////////////////////////////////////////////////

Plot(EMA(C,13),"",colorYellow);
/////////////////////////////////////////////////////////////

per1=Param ("per1", 0.325,0.1,50,0.10);

per=per1;
x = Cum(1);
s1=L;
s11=H;
pS = TroughBars( s1, per, 1 ) == 0;
endt= SelectedValue(ValueWhen( pS, x, 1 ));
startt=SelectedValue(ValueWhen( pS, x, 2 ));
dtS =endt-startt;
endS = SelectedValue(ValueWhen( pS, s1, 1 ) );
startS = SelectedValue( ValueWhen( pS, s1, 1 ));
aS = (endS-startS)/dtS;
bS = endS;
trendlineS = aS * ( x -endt ) + bS;
g3= IIf(x>startt-10,trendlineS,-1e10);
Plot(g3,"",colorRed,styleDashed);

pR = PeakBars( s11, per, 1 ) == 0;
endt1= SelectedValue(ValueWhen( pR, x, 1 ));
startt1=SelectedValue(ValueWhen( pR, x, 2 ));
dtR =endt1-startt1;
endR = SelectedValue(ValueWhen( pR, s11, 1 ) );
startR = SelectedValue( ValueWhen( pR, s11, 1 ));
aR = (endR-startR)/dtR;
bR = endR;
trendlineR = aR * ( x -endt1 ) + bR;
g4= IIf(x>startT1-10,trendlineR,-1e10);
Plot(g4,"",colorGreen,styleDashed);
//////////////////////////////////////////////////////////////////////////////////////////////////
perc=per1;
x=BarIndex();xx=SelectedValue(x);
t1=SelectedValue(ValueWhen(PeakBars(C,perc)==0,x)) ;
H1=SelectedValue(ValueWhen(PeakBars(C,perc)==0,C)) ;
t11=SelectedValue(ValueWhen(TroughBars(C,perc)==0, x));
H11=SelectedValue(ValueWhen(TroughBars(C,perc)==0, C));
g=t1>t11;
shape=IIf(g,shapeDownArrow*(x==t1),shapeUpArrow*(x ==t11));
Color=IIf(g,colorRed,colorGreen);
PlotShapes(shape,color);
/////////////////////////////////////////////////////////////////////////////////////////////////

per=per1;

x = Cum(1);
s1=C;
s11=C;
pS = TroughBars( s1, per, 1 ) == 0;
endt= SelectedValue(ValueWhen( pS, x, 1 ));
startt=SelectedValue(ValueWhen( pS, x, 2 ));
dtS =endt-startt;
endS = SelectedValue(ValueWhen( pS, s1, 1 ) );
startS = SelectedValue( ValueWhen( pS, s1, 2 ));
aS = (endS-startS)/dtS;
bS = endS;
trendlineS = aS * ( x -endt ) + bS;
g3= IIf(x>startt-10,trendlineS,-1e10);
Plot(g3,"",colorRed,styleThick);

pR = PeakBars( s11, per, 1 ) == 0;
endt1= SelectedValue(ValueWhen( pR, x, 1 ));
startt1=SelectedValue(ValueWhen( pR, x, 2 ));
dtR =endt1-startt1;
endR = SelectedValue(ValueWhen( pR, s11, 1 ) );
startR = SelectedValue( ValueWhen( pR, s11, 2 ));
aR = (endR-startR)/dtR;
bR = endR;
trendlineR = aR * ( x -endt1 ) + bR;
g4= IIf(x>startT1-10,trendlineR,-1e10);
Plot(g4,"",colorGreen,styleThick);
//////////////////////////////////////////////////////////////////////////////


Quoting mtuppers
Disliked
post your indicator for other to try, or you might want go to another forum to ask
Ignored
 
 
  • Post #6
  • Quote
  • Edited at 2:11am Jul 19, 2013 2:08am | Edited at 2:11am
  •  leenazen
  • | Membership Revoked | Joined Jul 2013 | 13 Posts
I NEED AFL TO MQ4 CONVERT

///////////This system has swing with ishimaku clouds and targets and stop loss

/////////////////////////////////// Programs Begins

//////////////////with near days high low scanner

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();



PctVlt=(ATR(10)/C)*100;//PercentVolatility

PK=IIf(PctVlt<0.5,Peak(Close,0.5,1),
IIf( PctVlt>=0.5 AND PctVlt< 1.0 ,Peak(Close,0.70,1),
IIf( PctVlt>=1.0 AND PctVlt< 1.5 ,Peak(Close,0.90,1),
IIf( PctVlt>=1.5 AND PctVlt< 2.0 ,Peak(Close,1.10,1),
IIf( PctVlt>=2.0 AND PctVlt< 2.5 ,Peak(Close,1.30,1),
IIf( PctVlt>=2.5 AND PctVlt< 3.0 ,Peak(Close,1.50,1),
IIf( PctVlt>=3.0 AND PctVlt< 3.5 ,Peak(Close,1.70,1),
IIf( PctVlt>=3.5 AND PctVlt< 4.0 ,Peak(Close,2.00,1),
Peak(Close,2.20,1) ))))))));

TGH=IIf(PctVlt<0.5,Trough(Close,0.5,1),
IIf( PctVlt>=0.5 AND PctVlt< 1.0 ,Trough(Close,0.75,1),
IIf( PctVlt>=1.0 AND PctVlt< 1.5 ,Trough(Close,1.00,1),
IIf( PctVlt>=1.5 AND PctVlt< 2.0 ,Trough(Close,1.25,1),
IIf( PctVlt>=2.0 AND PctVlt< 2.5 ,Trough(Close,1.50,1),
IIf( PctVlt>=2.5 AND PctVlt< 3.0 ,Trough(Close,1.75,1),
IIf( PctVlt>=3.0 AND PctVlt< 3.5 ,Trough(Close,2.00,1),
IIf( PctVlt>=3.5 AND PctVlt< 4.0 ,Trough(Close,2.25,1),
Trough(Close,2.50,1) ))))))));

Sens=IIf(PctVlt<0.5,0.5,
IIf( PctVlt>=0.5 AND PctVlt< 1.0 ,0.75,
IIf( PctVlt>=1.0 AND PctVlt< 1.5 ,1.00,
IIf( PctVlt>=1.5 AND PctVlt< 2.0 ,1.25,
IIf( PctVlt>=2.0 AND PctVlt< 2.5 ,1.50,
IIf( PctVlt>=2.5 AND PctVlt< 3.0 ,1.75,
IIf( PctVlt>=3.0 AND PctVlt< 3.5 ,2.00,
IIf( PctVlt>=3.5 AND PctVlt< 4.0 ,2.25,
2.50 ))))))));


Color=IIf(BarsSince(Cross(C,Ref(PK,-1)))<BarsSince(Cross(Ref(TGH,-1),C)),colorBrightGreen,colorRed);
Plot(C,"",Color,styleCandle);


DayH = TimeFrameGetPrice("H", inDaily, -1); DayHI = LastValue (DayH,1);// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1); DayLI = LastValue (DayL,1); // yesterdays low
DayC = TimeFrameGetPrice("C", inDaily, -1); // yesterdays close
DayO = TimeFrameGetPrice("O", inDaily); // current day open
DayH2= TimeFrameGetPrice("H", inDaily, -2); DayH2I = LastValue (DayH2,1); // Two days before high
DayL2= TimeFrameGetPrice("L", inDaily, -2); DayL2I = LastValue (DayL2,1); // Two days before low
DayH3= TimeFrameGetPrice("H", inDaily, -3); DayH3I = LastValue (DayH3,1); // Three days before high
DayL3= TimeFrameGetPrice("L", inDaily, -3); DayL3I = LastValue (DayL3,1); // Three days before low

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





////////////////////////////////////////////////////////////////////////////////////////////////




////////////////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

messageboard = ParamToggle("Message Board","Show|Hide",0);
showsl = ParamToggle("Stop Loss Line", "Show|Hide", 0);
no=10;
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
s5d=IIf(avn==1,sup,res);

if (showsl == 0)
//{Plot(s5d,"Stop Loss",colorCustom14,styleDots);}
exitlong = Cross(s5d, H);
PlotShapes(exitlong * shapeNone, colorBlack,0,H,-10);
exitshort = Cross(L, s5d);
PlotShapes(exitshort * shapeNone, colorBlack,0,L,-15);

Buy = exitshort;
Sell = exitlong;
//Short = Sell;
//Cover = Buy;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
//Short = ExRem(Short, Cover);
//Cover = ExRem(Cover, Short);
AlertIf( Buy, "", "BUY @ " + C, 1 );
AlertIf( Sell, "", "SELL @ " + C, 2 );
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);



for(i=BarCount-1;i>1;i--)
{
if(Buy == 1)
{
entry = C;
sig = "BUY";
sl = s5d;
tar1 = entry + (entry * .0050);
tar2 = entry + (entry * .0092);
tar3 = entry + (entry * .0179);

bars = i;
i = 0;
}
if(Sell == 1)
{
sig = "SELL";
entry = C;
sl = s5d;
tar1 = entry - (entry * .0050);
tar2 = entry - (entry * .0112);
tar3 = entry - (entry * .0212);


bars = i;
i = 0;
}
}
Offset = 20;
Clr = IIf(sig == "BUY", colorLime, colorRed);
ssl = IIf(bars == BarCount-1, s5d[BarCount-1], Ref(s5d, -1));
sl = ssl[BarCount-1];

Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine|styleDots, Null, Null, Offset);

Plot(LineArray(bars-Offset, sl, BarCount, sl,1), "", colorDarkRed, styleLine|styleLine, Null, Null, Offset);
Plot(LineArray(bars-Offset, entry, BarCount, entry,1), "", colorGreen, styleLine|styleLine, Null, Null, Offset);

for (i=bars; i <BarCount;i++)
{
PlotText(""+sig+"@"+entry, BarCount+1,entry,Null,colorBlue);
PlotText("[email protected]"+tar1,BarCount+3,tar1,Null,Clr);PlotText("[email protected]"+tar2,BarCount+3,tar2,Null,Clr);PlotText ("[email protected]"+tar3,BarCount+3,tar3,Null,Clr);

}


printf("Last " + sig + " Signal came " + (BarCount-bars) + " bars ago");
printf("n" + sig + " @ : " + entry + "nStop Loss : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"+ "nTarget_1 : " + tar1 + "nTarget_2 : " + tar2 + "nTarget_3 : " + tar3);
printf("nCurrent P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2));

if (messageboard == 0 )
{
GfxSelectFont( "Tahoma", 13, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );

if ( sig =="BUY")
{
GfxSelectSolidBrush( colorBlue ); // this is the box background color
}
else
{
GfxSelectSolidBrush( colorRed ); // this is the box background color
}
pxHeight = Status( "pxchartheight" ) ;
xx = Status( "pxchartwidth");
Left = 1100;
width = 310;
x = 5;
x2 = 290;

y = pxHeight;

GfxSelectPen( colorGreen, 1); // broader color
GfxRoundRect( x, y - 163, x2, y , 7, 7 ) ;
GfxTextOut( ( " Trading System "),88,y-165);
GfxTextOut( (" "),27,y-160);
GfxTextOut( ("Last " + sig + " Signal came " + (BarCount-bars-1) * Interval()/60 + " mins ago"), 13, y-140) ; // The text format location
GfxTextOut( ("" + WriteIf(sig =="BUY",sig + " @ ",sig + " @") + " : " + entry), 13, y-120);
GfxTextOut( ("Trailing SL : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"), 13, y-100);
GfxTextOut( ("TGT:1 : " + tar1), 13, y -80);
GfxTextOut( ("TGT:2 : " + tar2), 13,y-60);
GfxTextOut( ("TGT:3 : " + tar3), 13,y-40);
GfxTextOut( ("Current P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)), 88, y-22);;

}
//////////////////////////////////////////////////////////////////////////////////////////////////////////



//////////////////////////////////////////////////////////////////////////////////////////////////////////

_SECTION_BEGIN("Magnified Market Price");
FS=Param("Font Size",30,30,100,1);
GfxSelectFont("Arial", FS, 700, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorBlack) );
Hor=Param("Horizontal Position",750,800,800,800);
Ver=Param("Vertical Position",27,27,27,27);
GfxTextOut(""+C,Hor , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont("Arial", 12, 700, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor(ParamColor("Color",colorYellow) );
GfxTextOut(""+DD+" ("+xx+"%)", Hor+5, Ver+45 );
_SECTION_END();

////////////////////////////////////////////////////////////////////////////////




/////////////////////////////////////////////////////////////////////////////////////





//*Plot EMA*/
//Plot( EMA( Close,13), "13 EMA", colorRed,styleLine);
//Plot( EMA( Close,34), "34 EMA", colorBlue,styleLine);
//Plot( EMA( Close,55), "55 EMA", colorBlack,styleLine);
//Plot( EMA( Close,89), "89 EMA", colorYellow,styleLine);

//////////////////////Clouds
//

///////////////////////////////////// Swing
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// swing formula here
//---- heikin ashi
HaClose = (O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), .40);
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
xDiff = (HaHigh - Halow) * IIf(StrFind(Name(),"JPY"),100,10000);
// Plot(EMA(HaClose,9),"",colorWhite, styleLine);
// Plot(EMA(HaClose,18),"",colorBlack, styleLine);
_SECTION_BEGIN("Swing");
no=Param( "Swing", 10, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

//Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea
Plot(tsl, _DEFAULT_NAME(), tsl_col, styleDots |styleThick); // or styleaArea

_SECTION_END();





////////////////////details of stock at the title

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

_SECTION_END();



/////////////////////weekly high low

_SECTION_BEGIN("weekly-H-L");
Hclose=HHV(H,5);
Lclose= LLV(L,5);
DH = EncodeColor(colorDarkBlue) + "weekly-H-L = " + Hclose + "n";
DL = EncodeColor(colorDarkRed) + "weekly-H-L = " + Lclose + "n";
_N(Title = StrFormat("{{NAME}} ({{INTERVAL}}), {{DATE}} ; {{OHLCX}}, V=%1.0fn {{VALUES}}nn", V) + DH + DL);

_SECTION_END();

/////////////////Stock near days high and low scanner
TimeFrameSet(inHourly);
H1 = HHV(H, 1) ;

H2= (H1-C)< .001*C;

L1 = LLV(L,1) ;


L2 = (C-L1) < .001*C ;

TimeFrameRestore() ;

SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol");
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(C, "CMP", 1.2);



Filter = H2 OR L2 ;

Buy = H2 ;
Sell = L2 ;


///////////////////////////candle stick reader


_SECTION_BEGIN("Candle Identification");
O1 = Ref(O,-1);O2 = Ref(O,-2);
H1 = Ref(H,-1);H2 = Ref(H,-2);
L1 = Ref(L,-1);L2 = Ref(L,-2);
C1 = Ref(C,-1);C2 = Ref(C,-2);
function CandlePattern(P)
{
global PatternName;
if(P == 0) { PatternName = "NearDoji"; Pv = (abs(O-C)<= ((H-L)*0.1)); }
else if(P == 1) { PatternName = "BlackCandle"; Pv = (O>C); }
else if(P == 2) { PatternName = "LongBlackCandle"; Pv = (O>C AND
(O-C)/(.001+H-L)>.6); }
else if(P == 3) { PatternName = "SmallBlackCandle"; Pv = ((O>C) AND
((H-L)>(3*(O-C)))); }
else if(P == 4) { PatternName = "WhiteCandle"; Pv = (C>O); }
else if(P == 5) { PatternName = "LongWhiteCandle"; Pv = ((C>O) AND
((C-O)/(.001+H-L)>.6)); }
else if(P == 6) { PatternName = "SmallWhiteCandle"; Pv = ((C>O) AND
((H-L)>(3*(C-O)))); }
else if(P == 7) { PatternName = "BlackMaubozu"; Pv = (O>C AND H==O AND
C==L); }
else if(P == 8) { PatternName = "WhiteMaubozu"; Pv = (C>O AND H==C AND
O==L); }
else if(P == 9) { PatternName = "BlackClosingMarubozu"; Pv = (O>C AND
C==L); }
else if(P == 10) { PatternName = "WhiteClosingMarubozu"; Pv = (C>O AND
C==H); }
else if(P == 11) { PatternName = "BlackOpeningMarubozu"; Pv = (O>C AND
O==H); }
else if(P == 12) { PatternName = "WhiteOpeningMarubozu"; Pv = (C>O AND
O==L); }
else if(P == 13) { PatternName = "HangingMan"; Pv = (((H-L)>4*(O-C)) AND
((C-L)/(.001+H-L)>= 0.75) AND ((O-L)/(.001+H-L)>= 0.75)); }
else if(P == 14) { PatternName = "Hammer"; Pv = (((H-L)>3*(O-C)) AND
((C-L)/(.001+H-L)>0.6) AND ((O-L)/(.001+H-L)>0.6)); }
else if(P == 15) { PatternName = "InvertedHammer"; Pv = (((H-L)>3*(O-C))
AND ((H-C)/(.001+H-L)>0.6) AND ((H-O)/(.001+H-L)>0.6)); }
else if(P == 16) { PatternName = "ShootingStar"; Pv = (((H-L)>4*(O-C))
AND ((H-C)/(.001+H-L)>= 0.75) AND ((H-O)/(.001+H-L)>= 0.75)); }
else if(P == 17) { PatternName = "BlackSpinningTop"; Pv = ((O>C) AND
((H-L)>(3*(O-C))) AND (((H-O)/(.001+H-L))<.4) AND
(((C-L)/(.001+H-L))<.4)); }
else if(P == 18) { PatternName = "WhiteSpinningTop"; Pv = ((C>O) AND
((H-L)>(3*(C-O))) AND (((H-C)/(.001+H-L))<.4) AND
(((O-L)/(.001+H-L))<.4)); }
else if(P == 19) { PatternName = "BearishAbandonedBaby"; Pv = ((C1 == O1)
AND (C2>O2) AND (O>C) AND (L1>H2) AND (L1>H)); }
else if(P == 20) { PatternName = "BearishEveningDojiStar"; Pv = ((C2>O2)
AND ((C2-O2)/(.001+H2-L2)>.6) AND (C2<O1) AND (C1>O1) AND
((H1-L1)>(3*(C1-O1))) AND (O>C) AND (O<O1)); }
else if(P == 21) { PatternName = "DarkCloudCover"; Pv = (C1>O1 AND
((C1+O1)/2)>C AND O>C AND O>C1 AND C>O1 AND (O-C)/(.001+(H-L)>0.6)); }
else if(P == 22) { PatternName = "BearishEngulfing"; Pv = ((C1>O1) AND
(O>C) AND (O>= C1) AND (O1>= C) AND ((O-C)>(C1-O1))); }
else if(P == 23) { PatternName = "ThreeOutsideDownPattern"; Pv = ((C2>O2)
AND (O1>C1) AND (O1>= C2) AND (O2>= C1) AND ((O1-C1)>(C2-O2)) AND (O>C) AND
(C<C1)); }
else if(P == 24) { PatternName = "BullishAbandonedBaby"; Pv = ((C1 == O1)
AND (O2>C2) AND (C>O) AND (L2>H1) AND (L>H1)); }
else if(P == 25) { PatternName = "BullishMorningDojiStar"; Pv = ((O2>C2)
AND ((O2-C2)/(.001+H2-L2)>.6) AND (C2>O1) AND (O1>C1) AND
((H1-L1)>(3*(C1-O1))) AND (C>O) AND (O>O1)); }
else if(P == 26) { PatternName = "BullishEngulfing"; Pv = ((O1>C1) AND
(C>O) AND (C>= O1) AND (C1>= O) AND ((C-O)>(O1-C1))); }
else if(P == 27) { PatternName = "ThreeOutsideUpPattern"; Pv = ((O2>C2)
AND (C1>O1) AND (C1>= O2) AND (C2>= O1) AND ((C1-O1)>(O2-C2)) AND (C>O) AND
(C>C1)); }
else if(P == 28) { PatternName = "BullishHarami"; Pv = ((O1>C1) AND (C>O)
AND (C<= O1) AND (C1<= O) AND ((C-O)<(O1-C1))); }
else if(P == 29) { PatternName = "ThreeInsideUpPattern"; Pv = ((O2>C2)
AND (C1>O1) AND (C1<= O2) AND (C2<= O1) AND ((C1-O1)<(O2-C2)) AND (C>O) AND
(C>C1) AND (O>O1)); }
else if(P == 30) { PatternName = "PiercingLine"; Pv = ((C1<O1) AND
(((O1+C1)/2)<C) AND (O<C) AND (O<C1) AND (C<O1) AND
((C-O)/(.001+(H-L))>0.6)); }
else if(P == 31) { PatternName = "BearishHarami"; Pv = ((C1>O1) AND (O>C)
AND (O<= C1) AND (O1<= C) AND ((O-C)<(C1-O1))); }
else if(P == 32) { PatternName = "ThreeInsideDownPattern"; Pv = ((C2>O2)
AND (O1>C1) AND (O1<= C2) AND (O2<= C1) AND ((O1-C1)<(C2-O2)) AND (O>C) AND
(C<C1) AND (O<O1)); }
else if(P == 33) { PatternName = "ThreeWhiteSoldiers"; Pv = (C>O*1.01)
AND (C1>O1*1.01) AND (C2>O2*1.01) AND (C>C1) AND (C1>C2) AND (O<C1) AND
(O>O1) AND (O1<C2) AND (O1>O2) AND (((H-C)/(H-L))<.2) AND
(((H1-C1)/(H1-L1))<.2) AND (((H2-C2)/(H2-L2))<.2); }
else if(P == 34) { PatternName = "DarkCloudCover"; Pv = (C1>O1*1.01) AND
(O>C) AND (O>H1) AND (C>O1) AND (((C1+O1)/2)>C) AND (C>O1) AND
(MA(C,13)-Ref(MA(C,13),-4)>0); }
else if(P == 35) { PatternName = "ThreeBlackCrows"; Pv = (O>C*1.01) AND
(O1>C1*1.01) AND (O2>C2*1.01) AND (C<C1) AND (C1<C2) AND (O>C1) AND (O<O1)
AND (O1>C2) AND (O1<O2) AND (((C-L)/(H-L))<.2) AND (((C1-L1)/(H1-L1))<.2)
AND (((C2-L2)/(H2-L2))<.2); }
else if(P == 36) { PatternName = "doji"; Pv = (O == C); }
else if(P == 37) { PatternName = "GapUp"; Pv = GapUp(); }
else if(P == 38) { PatternName = "GapDown"; Pv = GapDown(); }
else if(P == 39) { PatternName = "BigGapUp"; Pv = L>1.01*H1; }
else if(P == 40) { PatternName = "BigGapDown"; Pv = H<0.99*L1; }
else if(P == 41) { PatternName = "HugeGapUp"; Pv = L>1.02*H1; }
else if(P == 42) { PatternName = "HugeGapDown"; Pv = H<0.98*L1; }
else if(P == 43) { PatternName = "DoubleGapUp"; Pv = GapUp() AND
Ref(GapUp(),-1); }
else if(P == 44) { PatternName = "DoubleGapDown"; Pv = GapDown() AND
Ref(GapDown(),-1); }
return Pv;
}

PatternNameList = "";
for(Cp=0; Cp<=44; Cp++)
{
VarSet("Pattern"+NumToStr(Cp,1.0),CandlePattern(cP));
PatternNameList = PatternNameList +PatternName+",";
}

BI = BarIndex();
SelectedBar = SelectedValue(BI) -BI[0];
//Selectedbar = Status("lastvisiblebar")-1;
PStr="";
for(Cp=0; Cp<=44; Cp++)
{
Temp = VarGet("Pattern"+NumToStr(Cp,1.0));
if(temp[SelectedBar]) Pstr=Pstr+"#"+NumToStr(Cp,1.0)+" - "+StrExtract(PatternNameList,Cp)+"n";
}


FS=Param("Font Size",11,11,100,1);
GfxSelectFont("Times New Roman", FS, 700, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorWhite) );
Hor=Param("Horizontal Position",237,1,1200,1);
Ver=Param("Vertical Position",50,1,830,1);
GfxTextOut("Candle Reader= "+Pstr, Hor , Ver );




_SECTION_END();

 
 
  • Post #7
  • Quote
  • Aug 26, 2013 12:27pm Aug 26, 2013 12:27pm
  •  leenazen
  • | Membership Revoked | Joined Jul 2013 | 13 Posts
I NEED FOR AFL TO MQ4 CONVERT

//+------------------------------------------------------------------+
//| RSI-3TF_ALERT_25.mq4
//+------------------------------------------------------------------+
#property copyright "AHGduP"
#property link "RSI-3TF_ALERT_25"

#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 Magenta
#property indicator_color2 Aqua
#property indicator_color3 Red
#property indicator_color4 Yellow
#property indicator_color5 White
#property indicator_color6 White
#property indicator_color7 GreenYellow
#property indicator_color8 Yellow

#property indicator_minimum 0
#property indicator_maximum 100

//=============================================================
#property indicator_level1 93
#property indicator_level3 50
#property indicator_level2 7
#property indicator_levelcolor DarkGray
#property indicator_levelstyle STYLE_DOT
#property indicator_levelwidth 0

//==================== INPUT =================================
extern string RSI_INPUT_1 = "=== RSI A ===";
extern int RSI_Period_1 = 2 ;
extern int RSI_Period_2 = 2 ;
extern int RSI_Period_3 = 2 ;//4

extern string RSI_INPUT_2 = "=== RSI B ===";
extern int RSI_Period_B1 = 2 ;//6
extern int RSI_Period_B2 = 2 ;//6
extern int RSI_Period_B3 = 2 ;//6
//============================================================

extern int TF1 = 0 ;
extern int TF2 = 0 ;
extern int TF3 = 0 ;

bool StepTF1_Up = true ;
bool StepTF2_Up = true ;
bool StepTF3_Up = true ;

extern int LineSize1 = 1 ;
extern int LineSize2 = 1 ;
extern int LineSize3 = 2 ;
extern int LineSize4 = 1 ;//<<<<<<<<< ek het bygesit
extern int DotSizeRSI = 1 ;
extern int DotSizeARROW = 1 ;
extern int DotSizeZERO = 1 ;
extern int DotSizeRSI5 = 4 ;
extern int NumberOfBars = 500 ;

double R1up,R2up,R3up;
double R1dn,R2dn,R3dn;
double up1, down1 ;

double BR1up,BR2up,BR3up;
double BR1dn,BR2dn,BR3dn;
double Bup1, Bdown1 ;
//------------------------------------------------
double RSIBuffer1[];
double RSIBuffer2[];
double RSIBuffer3[];
double RSIBuffer4[];
double upX[];
double dnX[];
double RSIBuffer5[];
double RSIBuffer6[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void init()
{
string short_name;
SetIndexStyle (0, DRAW_LINE, STYLE_SOLID, LineSize1);
SetIndexBuffer(0, RSIBuffer1);
SetIndexStyle (1, DRAW_LINE, STYLE_SOLID, LineSize2);
SetIndexBuffer(1, RSIBuffer2);
SetIndexStyle (2, DRAW_LINE, STYLE_SOLID, LineSize3);
SetIndexBuffer(2, RSIBuffer3);

SetIndexStyle(3,DRAW_ARROW,STYLE_SOLID,DotSizeRSI);
SetIndexArrow(3,159);
SetIndexBuffer(3,RSIBuffer4);

SetIndexStyle(4,DRAW_ARROW,STYLE_SOLID,DotSizeARROW);
SetIndexArrow(4,233);
SetIndexBuffer(4,upX);
SetIndexStyle(5,DRAW_ARROW,STYLE_SOLID,DotSizeARROW);
SetIndexArrow(5,234);
SetIndexBuffer(5,dnX);

SetIndexStyle(6,DRAW_ARROW,STYLE_SOLID,DotSizeZERO);
SetIndexArrow(6,159);
SetIndexBuffer(6,RSIBuffer5);

SetIndexStyle(7,DRAW_ARROW,STYLE_SOLID,DotSizeRSI5);
SetIndexArrow(7,159);
SetIndexBuffer(7,RSIBuffer6);

up1 = 0 ;
down1 = 0 ;
Bup1 = 0 ;
Bdown1 = 0 ;

//========================================================================================
switch(TF1) { case 1 : string TimeFrameStr1="Period_M1"; break;
case 5 : TimeFrameStr1="Period_M5"; break;
case 15 : TimeFrameStr1="Period_M15"; break;
case 30 : TimeFrameStr1="Period_M30"; break;
case 60 : TimeFrameStr1="Period_H1"; break;
case 240 : TimeFrameStr1="Period_H4"; break;
case 1440 : TimeFrameStr1="Period_D1"; break;
case 10080 : TimeFrameStr1="Period_W1"; break;
case 43200 : TimeFrameStr1="Period_MN1"; break;
default : TimeFrameStr1="Current Timeframe";
SetStepTF1_Up();
}
//=======================================================================================
switch(TF2) { case 1 : string TimeFrameStr2="Period_M1"; break;
case 5 : TimeFrameStr2="Period_M5"; break;
case 15 : TimeFrameStr2="Period_M15"; break;
case 30 : TimeFrameStr2="Period_M30"; break;
case 60 : TimeFrameStr2="Period_H1"; break;
case 240 : TimeFrameStr2="Period_H4"; break;
case 1440 : TimeFrameStr2="Period_D1"; break;
case 10080 : TimeFrameStr2="Period_W1"; break;
case 43200 : TimeFrameStr2="Period_MN1"; break;
default : TimeFrameStr2="Current Timeframe";
SetStepTF2_Up();
}
//=======================================================================================
switch(TF3) { case 1 : string TimeFrameStr3="Period_M1"; break;
case 5 : TimeFrameStr3="Period_M5"; break;
case 15 : TimeFrameStr3="Period_M15"; break;
case 30 : TimeFrameStr3="Period_M30"; break;
case 60 : TimeFrameStr3="Period_H1"; break;
case 240 : TimeFrameStr3="Period_H4"; break;
case 1440 : TimeFrameStr3="Period_D1"; break;
case 10080 : TimeFrameStr3="Period_W1"; break;
case 43200 : TimeFrameStr3="Period_MN1"; break;
default : TimeFrameStr3="Current Timeframe";
SetStepTF3_Up();
}
//=======================================================================================

string ThisName = "RSI-3TF_ALERT_22";
string Text=ThisName;
Text=Text+" ("+TF1;
Text=Text+", "+TF2;
Text=Text+", "+TF3;
Text=Text+")";
Text=Text+"(";
Text=Text+" "+DoubleToStr(RSI_Period_1,0);
Text=Text+", "+DoubleToStr(RSI_Period_2,0);
Text=Text+", "+DoubleToStr(RSI_Period_3,0);
Text=Text+") ";
IndicatorShortName(Text);

}

//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
void start()
{
static datetime AlertTime = 0;
int limit,LoopBegin, sh, nsb,nsb2,nsb3;

//---------------------------------------------------------------------
// limit=Bars-NumberOfBars+TF1/Period();
// limit=Bars-NumberOfBars+TF2/Period();
// limit=Bars-NumberOfBars+TF3/Period();

limit=Bars-NumberOfBars;
//--------------------------------------------------------------------

if (NumberOfBars==0) LoopBegin=Bars-1;
else LoopBegin=NumberOfBars-1;

for (sh=LoopBegin; sh>=0; sh--) {
nsb3=iBarShift(NULL, TF1, Time[sh], False);
nsb=iBarShift(NULL, TF2, Time[sh], False);
nsb2=iBarShift(NULL, TF3, Time[sh], False);

RSIBuffer1[sh]=iRSI(NULL, TF1, RSI_Period_1, PRICE_CLOSE, nsb3);
RSIBuffer2[sh]=iRSI(NULL, TF2, RSI_Period_2, PRICE_CLOSE, nsb);
RSIBuffer3[sh]=iRSI(NULL, TF3, RSI_Period_3, PRICE_CLOSE, nsb2);
RSIBuffer4[sh]=iRSI(NULL, TF3, RSI_Period_3, PRICE_CLOSE, nsb2);

//=========================================================================
if (RSIBuffer1[sh] > 50 ) R1up =1; else R1up =0;
if (RSIBuffer2[sh] > 50 ) R2up =1; else R2up =0;
if (RSIBuffer3[sh] > 50 ) R3up =1; else R3up =0;
if ( up1 == 0 && AlertTime != Time[sh] && ( R1up + R2up + R3up ) == 3 )
{ upX[sh] = 30;
PlaySound("buy.wav");
// AlertTime = Time[sh];
up1 = 1; down1 = 0;
}

if (RSIBuffer1[sh] < 50 ) R1dn =1; else R1dn =0;
if (RSIBuffer2[sh] < 50 ) R2dn =1; else R2dn =0;
if (RSIBuffer3[sh] < 50 ) R3dn =1; else R3dn =0;
if ( down1 == 0 && AlertTime != Time[sh] && ( R1dn + R2dn + R3dn ) == 3 )
{ dnX[sh] = 70;
PlaySound("sell.wav");
// AlertTime = Time[sh];
up1 = 0; down1 = 1;
}
//===========cancel signal and re enter in same direction===========================

if ( up1 == 1
&& ( R1up + R2up + R3up ) != 3

{ up1 = 0; down1 = 0;
}


if ( down1 == 1
&& ( R1dn + R2dn + R3dn ) != 3


{ up1 = 0; down1 = 0;
}

//====================================================================
if (RSIBuffer1[sh] > 50 && RSIBuffer1[sh+1] < 50 ) RSIBuffer5[sh] = 50;
if (RSIBuffer2[sh] > 50 && RSIBuffer2[sh+1] < 50 ) RSIBuffer5[sh] = 50;
if (RSIBuffer3[sh] > 50 && RSIBuffer3[sh+1] < 50 ) RSIBuffer5[sh] = 50;
if (RSIBuffer1[sh] < 50 && RSIBuffer1[sh+1] > 50 ) RSIBuffer5[sh] = 50;
if (RSIBuffer2[sh] < 50 && RSIBuffer2[sh+1] > 50 ) RSIBuffer5[sh] = 50;
if (RSIBuffer3[sh] < 50 && RSIBuffer3[sh+1] > 50 ) RSIBuffer5[sh] = 50;



//========================== RSI 5 =======================================

double RSIB1=iRSI(NULL, TF1, RSI_Period_B1, PRICE_CLOSE, nsb3);
double RSIB2=iRSI(NULL, TF2, RSI_Period_B2, PRICE_CLOSE, nsb);
double RSIB3=iRSI(NULL, TF3, RSI_Period_B3, PRICE_CLOSE, nsb2);

//=========================================================================
if (RSIB1 > 50 ) BR1up =1; else BR1up =0;
if (RSIB2 > 50 ) BR2up =1; else BR2up =0;
if (RSIB3 > 50 ) BR3up =1; else BR3up =0;
if ( Bup1 == 0 && ( BR1up + BR2up + BR3up ) == 3 )
{ RSIBuffer6[sh] = 95;
// PlaySound("buy.wav");
// AlertTime = Time[sh];
Bup1 = 1; Bdown1 = 0;
}

if (RSIBuffer1[sh] < 50 ) BR1dn =1; else BR1dn =0;
if (RSIBuffer2[sh] < 50 ) BR2dn =1; else BR2dn =0;
if (RSIBuffer3[sh] < 50 ) BR3dn =1; else BR3dn =0;
if ( Bdown1 == 0 && ( BR1dn + BR2dn + BR3dn ) == 3 )
{ RSIBuffer6[sh] = 95;
// PlaySound("sell.wav");
// AlertTime = Time[sh];
Bup1 = 0; Bdown1 = 1;
}
//===========cancel signal and re enter in same direction===========================

if ( Bup1 == 1
&& ( BR1up + BR2up + BR3up ) != 3

{ Bup1 = 0; Bdown1 = 0;
}


if ( Bdown1 == 1
&& ( BR1dn + BR2dn + BR3dn ) != 3


{ Bup1 = 0; Bdown1 = 0;
}
//========================================================================================
}
}
//==============================step timeframe up TF1====================================
void SetValues(int p1) { TF1 = p1; }
void SetStepTF1_Up() { switch (Period() )
{ case PERIOD_M1 : SetValues(PERIOD_M30); break;
case PERIOD_M5 : SetValues(PERIOD_H1); break;
case PERIOD_M15 : SetValues(PERIOD_H4); break;
case PERIOD_M30 : SetValues(PERIOD_D1); break;
case PERIOD_H1 : SetValues(PERIOD_W1); break;
case PERIOD_H4 : SetValues(PERIOD_MN1); break;
case PERIOD_D1 : SetValues(PERIOD_MN1); break;
case PERIOD_W1 : SetValues(PERIOD_MN1); break;
case PERIOD_MN1 : SetValues(PERIOD_MN1); break;
} }
//============================== TF2 ===================================================
void SetValues2(int p2) { TF2 = p2; }
void SetStepTF2_Up() { switch (Period()
{ case PERIOD_M1 : SetValues2(PERIOD_M15); break;
case PERIOD_M5 : SetValues2(PERIOD_M30); break;
case PERIOD_M15 : SetValues2(PERIOD_H1); break;
case PERIOD_M30 : SetValues2(PERIOD_H4); break;
case PERIOD_H1 : SetValues2(PERIOD_D1); break;
case PERIOD_H4 : SetValues2(PERIOD_W1); break;
case PERIOD_D1 : SetValues2(PERIOD_MN1); break;
case PERIOD_W1 : SetValues2(PERIOD_MN1); break;
case PERIOD_MN1 : SetValues2(PERIOD_MN1); break;
} }
//=============================== TF3 ==================================================
void SetValues3(int p3) { TF3 = p3; }
void SetStepTF3_Up() { switch (Period() )
{ case PERIOD_M1 : SetValues3(PERIOD_M5); break;
case PERIOD_M5 : SetValues3(PERIOD_M15); break;
case PERIOD_M15 : SetValues3(PERIOD_M30); break;
case PERIOD_M30 : SetValues3(PERIOD_H1); break;
case PERIOD_H1 : SetValues3(PERIOD_H4); break;
case PERIOD_H4 : SetValues3(PERIOD_D1); break;
case PERIOD_D1 : SetValues3(PERIOD_W1); break;
case PERIOD_W1 : SetValues3(PERIOD_MN1); break;
case PERIOD_MN1 : SetValues3(PERIOD_MN1); break;
} }
//================================================================================== ++
Attached Image (click to enlarge)
Click to Enlarge

Name: Screenshot1.png
Size: 39 KB
 
 
  • Post #8
  • Quote
  • Sep 3, 2013 3:31am Sep 3, 2013 3:31am
  •  leenazen
  • | Membership Revoked | Joined Jul 2013 | 13 Posts
I NEED FOR AFL TO MQ4 CONVERT

//+------------------------------------------------------------------+
//| ZIG ZAG NON REPAINT.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright2010"
#property link ""

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow
extern int Candle=100;
extern int Length=1;
double ExtMapBuffer1[];

int init()
{
SetIndexEmptyValue(0,0.0);
SetIndexStyle(0,DRAW_SECTION, 5,5);
SetIndexBuffer(0,ExtMapBuffer1);

return(0);
}
int deinit()
{
return(0);
}
int start()
{
int cnt,ticket,counted_bars=IndicatorCounted();
int shift,Swing,Swing_n,uzl,i,zu,zd,mv;
double LL,HH,BH,BL,NH,NL;
double Uzel[10000][3];
string text;

if (High[1]> High[0]) {Comment("SELL !!");}

else if (High[1]< High[0]) {Comment("BUY !!");}
Swing_n=0;Swing=0;uzl=0;
BH =High[Candle];BL=Low[Candle];zu=Candle;zd=Candle;

for (shift=Candle;shift>=0;shift--) {
LL=10000000;HH=-100000000;
for (i=shift+Length;i>=shift+1;i--) {
if (Low< LL) {LL=Low;}
if (High>HH) {HH=High;}
}
if (Low[shift]<LL && High[shift]>HH){
Swing=2;
if (Swing_n==1) {zu=shift+1;}
if (Swing_n==-1) {zd=shift+1;}
} else {
if (Low[shift]<LL) {Swing=-1;}
if (High[shift]>HH) {Swing=1;}
}

if (Swing!=Swing_n && Swing_n!=0) {
if (Swing==2) {
Swing=-Swing_n;BH = High[shift];BL = Low[shift];
}
uzl=uzl+1;
if (Swing==1) {
Uzel[uzl][1]=zd;
Uzel[uzl][2]=BL;
}
if (Swing==-1) {
Uzel[uzl][1]=zu;
Uzel[uzl][2]=BH;
}
BH = High[shift];
BL = Low[shift];
}

if (Swing==1) {
if (High[shift]>=BH) {BH=High[shift];zu=shift;}}
if (Swing==-1) {
if (Low[shift]<=BL) {BL=Low[shift]; zd=shift;}}
Swing_n=Swing;
}
for (i=1;i<=uzl;i++) {
mv=StrToInteger(DoubleToStr(Uzel[1],0));
ExtMapBuffer1[mv]=Uzel[2];
}

return(0);
}
 
 
  • Post #9
  • Quote
  • Sep 4, 2013 7:27am Sep 4, 2013 7:27am
  •  leenazen
  • | Membership Revoked | Joined Jul 2013 | 13 Posts
Quoting leenazen
Disliked
I NEED FOR AFL TO MQ4 CONVERT //+------------------------------------------------------------------+ //| RSI-3TF_ALERT_25.mq4 //+------------------------------------------------------------------+ #property copyright "AHGduP" #property link "RSI-3TF_ALERT_25" #property indicator_separate_window #property indicator_buffers 8 #property indicator_color1 Magenta #property indicator_color2 Aqua #property indicator_color3 Red #property indicator_color4 Yellow #property indicator_color5 White #property indicator_color6 White #property indicator_color7...
Ignored
Attached File
File Type: mq4 RSI-3TF_ALERT_22c1b.mq4   14 KB | 1,312 downloads
 
 
  • Post #10
  • Quote
  • Sep 5, 2013 2:48pm Sep 5, 2013 2:48pm
  •  faststare08
  • | Commercial Member | Joined Jan 2013 | 224 Posts
Quoting leenazen
Disliked
{quote} {file}
Ignored
anyone still convert a afl formula to mt4?
 
 
  • Post #11
  • Quote
  • Sep 10, 2013 12:48pm Sep 10, 2013 12:48pm
  •  leenazen
  • | Membership Revoked | Joined Jul 2013 | 13 Posts

I NEED FOR MQ4 to AFL CONVERT


//+------------------------------------ ------------------------------+

//| ZIG ZAG NON REPAINT.mq4 |

//+------------------------------------ ------------------------------+

#property copyright "Copyright2010"

#property link ""


#property indicator_chart_window

#property indicator_buffers 1

#property indicator_color1 Yellow

extern int Candle=100;

extern int Length=1;

double ExtMapBuffer1[];


int init()

{

SetIndexEmptyValue(0,0.0);

SetIndexStyle(0,DRAW_SECTION, 5,5);

SetIndexBuffer(0,ExtMapBuffer1);


return(0);

}

int deinit()

{

return(0);

}

int start()

{

int cnt,ticket,counted_bars=IndicatorCo unted();

int shift,Swing,Swing_n,uzl,i,zu,zd,mv;

double LL,HH,BH,BL,NH,NL;

double Uzel[10000][3];

string text;


if (High[1]> High[0]) {Comment("SELL !!");}


else if (High[1]< High[0]) {Comment("BUY !!");}

Swing_n=0;Swing=0;uzl=0;

BH =High[Candle];BL=Low[Candle];zu=Candle;zd=Candle;


for (shift=Candle;shift>=0;shift--) {

LL=10000000;HH=-100000000;

for (i=shift+Length;i>=shift+1;i--) {

if (Low< LL) {LL=Low;}
if (High>HH) {HH=High;}
}
if (Low[shift]<LL && High[shift]>HH){
Swing=2;
if (Swing_n==1) {zu=shift+1;}
if (Swing_n==-1) {zd=shift+1;}
} else {
if (Low[shift]<LL) {Swing=-1;}
if (High[shift]>HH) {Swing=1;}
}

if (Swing!=Swing_n && Swing_n!=0) {
if (Swing==2) {
Swing=-Swing_n;BH = High[shift];BL = Low[shift];
}
uzl=uzl+1;
if (Swing==1) {
Uzel[uzl][1]=zd;
Uzel[uzl][2]=BL;
}
if (Swing==-1) {
Uzel[uzl][1]=zu;
Uzel[uzl][2]=BH;
}
BH = High[shift];
BL = Low[shift];
}

if (Swing==1) {
if (High[shift]>=BH) {BH=High[shift];zu=shift;}}
if (Swing==-1) {
if (Low[shift]<=BL) {BL=Low[shift]; zd=shift;}}
Swing_n=Swing;
}
for (i=1;i<=uzl;i++) {
mv=StrToInteger(DoubleToStr(Uzel[1],0));
ExtMapBuffer1[mv]=Uzel[2];
}

return(0);
}

Attached File
File Type: mq4 ZIG ZAG NRP.mq4   2 KB | 1,148 downloads
 
 
  • Post #12
  • Quote
  • Feb 7, 2014 1:33am Feb 7, 2014 1:33am
  •  kacraj
  • | Joined Dec 2011 | Status: Junior Member | 1 Post
I want someone to convert this AFL code to MT4 code:

_SECTION_BEGIN("KPL Swing with N&M Swing");
SetBarsRequired(200,0);

GraphXSpace = 5;
SetChartOptions(0,chartShowArrows|chartShowDates);
k = Optimize("K",Param("K",2,0.25,5,0.25),0.25,5,0.25);
Per= Optimize("atr",Param("atr",20,3,20,1),3,20,1);
HACLOSE=(O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorBlack, styleCandle | styleNoLabel );
j=Haclose;

//=======================================================================================================================
//=========================Indicator==============================================================================================
f=ATR(15);

rfsctor = WMA(H-L, Per);

revers = k * rfsctor;

Trend = 1;
NW[0] = 0;
NW[BarCount-1] = Null;


for(i = 1; i < BarCount-1; i++)
{
if(Trend[i-1] == 1)
{
if(j[i] < NW[i-1])
{
Trend[i] = -1;
NW[i] = j[i] + Revers[i];
}
else
{
Trend[i] = 1;
if((j[i] - Revers[i]) > NW[i-1])
{
NW[i] = j[i] - Revers[i];
}
else
{
NW[i] = NW[i-1];
}
}
}
if(Trend[i-1] == -1)
{
if(j[i] > NW[i-1])
{
Trend[i] = 1;
NW[i] = j[i] - Revers[i];
}
else
{
Trend[i] = -1;
if((j[i] + Revers[i]) < NW[i-1])
{
NW[i] = j[i] + Revers[i];
}
else
{
NW[i] = NW[i-1];
}
}
}
}

//===============system================

Plot(NW, "", IIf(Trend == 1, 27, 4), 4);
Buy=NW<HACLOSE;
Sell=NW>HACLOSE;
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy );

Short=Sell;
Cover=Buy;


NMAB= NW<HACLOSE;
NMAS= NW>HACLOSE;
AlertIf( Buy , "SOUND C://Windows//Media//chimes.wav", "Audio alert", 2 );
AlertIf( Sell , "SOUND C://Windows//Media//alert.wav", "Audio alert", 2 );

NMA_status= WriteIf(NMAB, "BUY MODE", WriteIf(NMAS, "SELL MODE", "NEUTRAL"));
NMAS_Col=IIf(NMAB, colorGreen, IIf(NMAS, colorRed, colorLightGrey));
Filter=1;
AddColumn( NW[BarCount-1], "SAR", 1.2 );
AddColumn( HACLOSE, "HA Close", 1.2 );
AddColumn( C, "Close", 1.2 );
AddTextColumn(NMA_status, "MODE", 1, colorWhite, NMAS_Col);
AddColumn( DateTime(), "Date / Time", formatDateTime );
_SECTION_END();
//=================TITLE================================================================================================
_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorWhite)+ "Swing Trade" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorRed) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+
EncodeColor(colorLime)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"",""));
//WriteIf(Long AND NOT Buy, "Trade : Long - Entry price Rs."+(BuyPrice),"")+
//WriteIf(shrt AND NOT Sell, "Trade : Short - Entry price Rs."+(SellPrice),"")+"\n"+
//WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
//WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"",""));
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);



for(i=BarCount-1;i>1;i--)
{
if(Buy[i] == 1)
{
entry = H[i];
sig = "BUY";
sl = Ref(NW,-1);
tar1 = entry + (entry * .0050);
tar2 = entry + (entry * .0092);
tar3 = entry + (entry * .0179);


bars = i;
i = 0;
}
if(Sell[i] == 1)
{
sig = "SELL";
entry = L[i];
sl = Ref(NW,-1);
tar1 = entry - (entry * .0050);
tar2 = entry - (entry * .0112);
tar3 = entry - (entry * .0212);


bars = i;
i = 0;
}
}
Offset = 20;
Clr = IIf(sig == "BUY", colorLime, colorRed);
ssl = IIf(bars == BarCount-1, NW[BarCount-1], Ref(NW, -1));
sl = ssl[BarCount-1];

Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine|styleDots, Null, Null, Offset);



messageboard = ParamToggle("Message Board","Show|Hide",1);
if (messageboard == 1 )
{
GfxSelectFont( "Tahoma", 13, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );

if ( sig =="BUY")
{
GfxSelectSolidBrush( colorGreen ); // this is the box background color
}
else
{
GfxSelectSolidBrush( colorRed ); // this is the box background color
}
pxHeight = Status( "pxchartheight" ) ;
xx = Status( "pxchartwidth");
Left = 1100;
width = 310;
x = 5;
x2 = 290;

y = pxHeight;

GfxSelectPen( colorGreen, 1); // broader color
GfxRoundRect( x, y - 160, x2, y , 5, 5 ) ;
GfxTextOut( ( "Swing Trade"),13,y-160);
GfxTextOut( (" "),27,y-160);
GfxTextOut( ("Last " + sig + " Signal came " + (BarCount-bars-1) * Interval()/60 + " mins ago"), 13, y-140) ; // The text format location
GfxTextOut( ("" + WriteIf(sig =="BUY",sig + " @ ",sig + " @") + " : " + entry), 13, y-120);
GfxTextOut( ("Trailing SL : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"), 13, y-100);
GfxTextOut( ("TGT:1 : " + tar1), 13, y -80);
GfxTextOut( ("TGT:2 : " + tar2), 13,y-60);
GfxTextOut( ("TGT:3 : " + tar3), 13,y-40);
GfxTextOut( ("Current P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)), 13, y-20);

}

_SECTION_END();

_SECTION_END();
function ChandelierCl(AtrARRAY, AtrMult) {
// Skip empty values
i = 0;
do {
result[i] = Null;
i++;
}
while( i < BarCount AND (IsNull(O[i]) OR IsNull(H[i]) OR IsNull(L[i]) OR IsNull(C[i]) ) );
First = i;

if (i < BarCount - 1) {
HHC[First] = C[First];
LLC[First] = C[First];

if (C[First + 1] > HHC[First]) {
HHC[First + 1] = C[First + 1];
LLC[First + 1] = LLC[First];
result[First] = C[First] - AtrMult * AtrARRAY[First];
iTrade = "LT";
}
else {
if (C[First + 1] < LLC[First]) {
HHC[First = 1] = HHC[First];
LLC[First + 1] = LLC[First + 1];
result[First] = C[First] + AtrMult * AtrARRAY[First];
iTrade = "ST";
}
else {
HHC[First + 1] = C[First + 1];
LLC[First + 1] = C[First + 1];
result[First] = C[First] - AtrMult * AtrARRAY[First];
iTrade = "LT";
}
}

for( i = First; i < BarCount; i++ ) {
if (iTrade == "LT") {
if (C[i] >= result[i-1]) { // Long Trade is continuing
if (C[i] > C[i-1]) {
HHC[i] = C[i];
}
else {
HHC[i] = HHC[i-1];
}
result[i] = HHC[i] - AtrMult * AtrARRAY[i];
if (result[i] < result[i-1]) {
result[i] = result[i-1];
}
}
else { // Long trade Exit triggered
iTrade = "ST";
LLC[i] = C[i];
result[i] = C[i] + AtrMult * AtrARRAY[i];
}
}
else { // Short trade
if (C[i] <= result[i-1]) {
if (C[i] <= C[i-1]) { // Short Trade is continuing
LLC[i] = C[i];
}
else {
LLC[i] = LLC[i-1];
}
result[i] = LLC[i] + AtrMult * AtrARRAY[i];
if (result[i] > result[i-1]) {
result[i] = result[i-1];
}
}
else { //Short Trade Exit is triggered
iTrade = "LT";
HHC[i] = C[i];
result[i] = C[i] - AtrMult * AtrARRAY[i];
}
}
}
}
return result;
}

function ChandelierHL(AtrARRAY, AtrMult) {
// Skip empty values
i = 0;
do {
result[i] = Null;
i++;
}
while( i < BarCount AND (IsNull(O[i]) OR IsNull(H[i]) OR IsNull(L[i]) OR IsNull(C[i]) ) );
First = i;

if (i < BarCount - 1) {
HHC[First] = H[First];
LLC[First] = L[First];

if (H[First + 1] > HHC[First]) {
HHC[First + 1] = H[First + 1];
LLC[First + 1] = LLC[First];
result[First] = H[First] - AtrMult * AtrARRAY[First];
iTrade = "LT";
}
else {
if (L[First + 1] < LLC[First]) {
HHC[First = 1] = HHC[First];
LLC[First + 1] = LLC[First + 1];
result[First] = L[First] + AtrMult * AtrARRAY[First];
iTrade = "ST";
}
else {
HHC[First + 1] = C[First + 1];
LLC[First + 1] = C[First + 1];
result[First] = H[First] - AtrMult * AtrARRAY[First];
iTrade = "LT";
}
}

for( i = First; i < BarCount; i++ ) {
if (iTrade == "LT") {
if (C[i] >= result[i-1]) { // Long Trade is continuing
if (H[i] > H[i-1]) {
HHC[i] = H[i];
}
else {
HHC[i] = HHC[i-1];
}
result[i] = HHC[i] - AtrMult * AtrARRAY[i];
if (result[i] < result[i-1]) {
result[i] = result[i-1];
}
}
else { // Long trade Exit triggered
iTrade = "ST";
LLC[i] = L[i];
result[i] = L[i] + AtrMult * AtrARRAY[i];
}
}
else { // Short trade
if (C[i] <= result[i-1]) {
if (L[i] <= L[i-1]) { // Short Trade is continuing
LLC[i] = L[i];
}
else {
LLC[i] = LLC[i-1];
}
result[i] = LLC[i] + AtrMult * AtrARRAY[i];
if (result[i] > result[i-1]) {
result[i] = result[i-1];
}
}
else { //Short Trade Exit is triggered
iTrade = "LT";
HHC[i] = H[i];
result[i] = H[i] - AtrMult * AtrARRAY[i];
}
}
}
}
return result;
}
 
 
  • Post #13
  • Quote
  • Feb 8, 2014 7:23am Feb 8, 2014 7:23am
  •  saeed_tam
  • | Joined Feb 2014 | Status: Junior Member | 1 Post
I NEED AFL TO MQ5 CONVERT

p1=Param("Period MA",1);
C0=EMA(C,p1);
O0=EMA(O,p1);
a3=Ref(C0,-3);
a2=Ref(C0,-2);
a1=Ref(C0,-1);
a0=C0;
b1=Ref(O0,-1);
b0=O0;
y=IIf(a0 < a1 & a1< a2 & a2<a3,-1,IIf(a0>=b0 & a1>= b1,1,0));
Plot(y,"Nirvana",colorBlue,styleLine);
Plot(0,"",colorRed,styleDashed);
//////////////////////////////////////
//Plot(C,"Close",colorBlack,styleCandle|styleOwnScale);

Buy=(y>0);//Ref(y,-1)<0 AND y==1);
Sell=(y<0);//Ref(y,-1)>0 AND y==-1);

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

PlotShapes(Buy * shapeUpArrow, colorGreen);
PlotShapes(Sell* shapeDownArrow, colorRed);
 
 
  • Post #14
  • Quote
  • Jun 11, 2014 3:23am Jun 11, 2014 3:23am
  •  unimak
  • | Joined Nov 2009 | Status: Member | 709 Posts
hi can somebody pls convert the AFL code to mql 4 and display the cover and short arrow on the screen in day chart

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
if( ParamToggle("Tooltip shows", "All Values|Only Prices" ) )
{
ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
}
_SECTION_END();
_SECTION_BEGIN("MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 200, 1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") | styleNoRescale );
_SECTION_END();
_SECTION_BEGIN("Mid MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 45, 2, 300, 1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") | styleNoRescale );
_SECTION_END();
_SECTION_BEGIN("Long MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 100, 2, 400, 1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") | styleNoRescale );
_SECTION_END();
_SECTION_BEGIN("BBands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorLightGrey );
Style = ParamStyle("Style") | styleNoRescale | styleNoRescale;
Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style );
Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style );
_SECTION_END();
_SECTION_BEGIN("Volume");
Plot( Volume, _DEFAULT_NAME(), ParamColor("Color", colorLavender ), styleNoTitle | ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick | styleNoLabel, maskHistogram ), 2 );
_SECTION_END();
_SECTION_BEGIN("Price Interpretation");
movshort = ParamField("Short Time MA", 8 );
movmed = ParamField("Mid Time MA", 9 );
movlong = ParamField("Long Time MA", 10 );
btop = ParamField("BBTop", 11 );
bbot = ParamField("BBBottom", 12 );
if( Status("action") == actionCommentary )
{
width = btop - bbot;
lslop = LinRegSlope( C, 30 ) + 100;
lslo = LLV( lslop, 90 );
lshi = HHV( lslop, 90 );
lswidth = lshi - lslo;
trend = 100*( lslop - lslo )/lswidth;
mawidth = MA( width, 100 );
relwidth = 100*(width - mawidth)/mawidth;
_N( tname = Name()+"("+FullName()+")" );
printf("Price and moving averages:\n");
printf( tname + " has closed " + WriteIf( C > movshort, "above" , "below" ) + " its Short time moving average. ");
printf("\nShort time moving average is currently " + WriteIf( movshort > movmed, "above", "below") + " mid-time, AND " + WriteIf( movshort > movlong, "above", "below" ) + " long time moving averages.");
printf("\nThe relationship between price and moving averages is: "+
WriteIf( C > movshort AND movshort > movmed, "bullish",
WriteIf( C < movshort AND movshort < movmed, "bearish", "neutral" ) ) + " in short-term, and "+
WriteIf( movshort > movmed AND movmed > movlong , "bullish",
WriteIf( movshort < movmed AND movmed < movlong, "bearish", "neutral" ) ) + " in mid-long term. ");
printf("\n\nBollinger Bands:\n");
printf(tname+ " has closed " +
WriteIf( C < bbot, "below the lower band by " +
WriteVal( 100 *( bbot-C )/ width, 1.1 ) + "%%. " +
WriteIf( trend < 30, " This combined with the steep downtrend can suggest that the downward trend in prices has a good chance of continuing. However, a short-term pull-back inside the bands is likely.",
WriteIf( trend > 30 AND trend < 70, "Although prices have broken the lower band and a downside breakout is possible, the most likely scenario for "+tname+" is to continue within current trading range.", "" ) ), "" ) +
WriteIf( C > btop, "above the upper band by " +
WriteVal( 100 *( C- btop )/ width, 1.1 ) + "%%. " +
WriteIf( trend > 70, " This combined with the steep uptrend suggests that the upward trend in prices has a good chance of continuing. However, a short-term pull-back inside the bands is likely.",
WriteIf( trend > 30 AND trend < 70, "Although prices have broken the upper band and a upside breakout is possible, the most likely scenario for "+tname+" is to continue within current trading range.", "" ) ), "" ) +
WriteIf( C < btop AND ( ( btop - C ) / width ) < 0.5,
"below upper band by " +
WriteVal( 100 *( btop - C )/ width, 1.1 ) + "%%. ",
WriteIf( C < btop AND C > bbot , "above bottom band by " +
WriteVal( 100 *( C - bbot )/ width, 1.1 ) + "%%. ", "" ) ));
printf("\n"+
WriteIf( ( trend > 30 AND trend < 70 AND ( C > btop OR C < bbot ) ) AND abs(relwidth) > 40,
"This picture becomes somewhat unclear due to the fact that Bollinger Bands are currently",
"Bollinger Bands are " )+
WriteVal( abs( relwidth ), 1.1 ) + "%% " +
WriteIf( relwidth > 0, "wider" , "narrower" ) +
" than normal.");
printf("\n");
printf(
WriteIf( abs( relwidth ) < 40, "The current width of the bands (alone) does not suggest anything conclusive about the future volatility or movement of prices.","")+
WriteIf( relwidth < -40, "The narrow width of the bands suggests low volatility as compared to " + tname + "'s normal range. Therefore, the probability of volatility increasing with a sharp price move has increased for the near-term. "+
"The bands have been in this narrow range for " + WriteVal(BarsSince(Cross(-40,relwidth)),1.0) + " bars. The probability of a significant price move increases the longer the bands remain in this narrow range." ,"")+
WriteIf( relwidth > 40, "The large width of the bands suggest high volatility as compared to " + tname + "'s normal range. Therefore, the probability of volatility decreasing and prices entering (or remaining in) a trading range has increased for the near-term. "+
"The bands have been in this wide range for " + WriteVal(BarsSince(Cross(relwidth,40)),1.0) + " bars.The probability of prices consolidating into a less volatile trading range increases the longer the bands remain in this wide range." ,""));
printf("\n\nThis commentary is not a recommendation to buy or sell. Use at your own risk.");
}
_SECTION_END();
_SECTION_END();
_SECTION_END();
_SECTION_BEGIN("aligaristrend");
PercentChange = 6;
mystartbar = SelectedValue(BarIndex()); // FOR GRAPHING
mystartbardate = LastValue(ValueWhen(mystartbar == BarIndex(), DateNum(),1));
InitialValue = LastValue(ValueWhen(mystartbardate == DateNum(), C , 1 ) ) ;
Temp1 = IIf(BarIndex() >= mystartbar, InitialValue, Null) ;
Plot(Temp1, " ", colorBlack,styleLine);
Plot((1+(LastValue(PercentChange)/100))*(Temp1), " ", colorGreen, styleLine) ;
Plot((1-(LastValue(PercentChange)/100))*(Temp1), " ", colorRed, styleLine) ;
ZZ = Zig(C,LastValue(PercentChange)) ;
PivotLow = Ref(IIf(Ref(ROC(ZZ,1),-1) < 0 AND ROC(ZZ,1) > 0, 1, Null),1);
PivotHigh = Ref(IIf(Ref(ROC(ZZ,1),-1) > 0 AND ROC(ZZ,1) < 0, 1, Null),1);
PlotShapes( shapeCircle*PivotLow, colorGreen,0, L, -20) ;
PlotShapes( shapeCircle*PivotHigh,colorRed,0,H, 20) ;
Buy = IIf(C>(1+(LastValue(PercentChange)/100))*(ValueWhen(PivotLow, C,
1))
AND ROC(ZZ,1) > 0,1,0);
Sell = IIf(C<(1-(LastValue(PercentChange)/100))*(ValueWhen(PivotHigh, C,
1))
AND ROC(ZZ,1) < 0,1,0);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
PlotShapes( shapeUpArrow*Buy, colorGreen,0, L, -20);
PlotShapes( shapeDownArrow*Sell, colorRed,0,H, -20) ;
BarColors =
IIf(BarsSince(Buy) < BarsSince(Sell)
AND BarsSince(Buy)!=0, colorGreen,
IIf(BarsSince(Sell) < BarsSince(Buy)
AND BarsSince(Sell)!=0, colorRed, colorBlue));
Plot(C, " ", BarColors, styleBar ) ;
Plot(ZZ," ", colorLightGrey,styleLine|styleThick);
Plot(ZZ," ", BarColors,styleDots|styleNoLine);
Title = Name() + " " + Date() + WriteIf(PivotLow, " Up Pivot
","")+WriteIf(PivotHigh," Down Pivot ","")+ WriteIf(Buy, " Buy Point ",
"") + WriteIf(Sell, " Sell Point ", "") ;
P = ParamField( "Price field" );
change = Param("% change",0.5,0.5,25,0.5);
z = Zig(P, change);
Plot( z, _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
myBuy = IIf(z > Ref(z, -1), 1, 0);
mySell = IIf(z < Ref(z, -1), 1, 0);
Buy = Cover = ExRem(myBuy, mySell);
Sell = Short = ExRem(mySell, mybuy);
Filter = Buy OR Sell;
AddColumn(Buy, "Buy", 1.0);
AddColumn(Sell, "Sell", 1.0);
_SECTION_END();
_SECTION_BEGIN("1500");
aK = LLV(L,260);
bK = HHV(H,260);
cK= bK > aK + aK;
dK = LastValue(C);
eK = dK < bK AND dK > bK * 0.75 ;
Flx = aK AND bK AND cK AND dK AND eK ;
//... Asish vol
bVV = V > Ref(V,-1) + Ref(V,-1) * 0.8 ;
//... 4% breakout
Brk_5pc = C > Ref(C,-1) + Ref(C,-1) * 0.004;
//.... liquidity
Liquid = MA(C,21) * MA(V,21) > 25000 ;//

//....................
Ready_Steady_Go = Flx AND bVV AND Brk_5pc AND Liquid;
Buy = Ready_Steady_Go ;
Sell= 0;
Filter = Buy;
AddColumn(LastValue(C),"Currant",1.0,colorBlack,colorTan);
_SECTION_END();
 
 
  • Post #15
  • Quote
  • Aug 6, 2014 4:30am Aug 6, 2014 4:30am
  •  amol123
  • | Joined Jun 2011 | Status: Member | 96 Posts
i need AFL TO MQ4 converter for following afl code can anybody help me ?

TimeFrameSet(inDaily);
DayHigh = LastValue(H);
DayLow = LastValue(L);
TimeFrameRestore();
Title = Date() + ", Op=" + Open + ", Hi=" + High + ", Lo=" + Low + ", LTP=" + Close + ", Change= " + SelectedValue( ROC( C, 1 ) ) + "%" + "\n Today`s High=" + DayHigh + ", Today`s Low=" + DayLow + " PRIME SYSTEM" ;

prev=AMA2(C,1,0);
d=IIf(C>Ref(Max(Max(H,Ref(H,-20)),Max(Ref(H,-10),Ref(H,-15))),-1),Min(Min(L,Ref(L,-20)),Min(Ref(L,-10),Ref(L,-15))),
IIf(C<Ref(Min(Min(L,Ref(L,-20)),Min(Ref(L,-10),Ref(L,-15))),-1),Max(Max(H,Ref(H,-20)),Max(Ref(H,-10),Ref(H,-15))),PREV));
a=Cross(Close,d);
b=Cross(d,Close);
state=IIf(BarsSince(a)<BarsSince(b),1,0);
s=state>Ref(state,-1);
ss=state<Ref(state,-1);
sss=state==Ref(state,-1);
col=IIf(state == 1 ,51,IIf(state ==0,4,1));
Plot(C,"",Col,64);
Buy = s;
Sell = ss;
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes(shape, IIf(Buy,colorGreen,colorRed), 0, IIf(Buy,Low,High));
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-10);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-20);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-15);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=20);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25);
//WriteIf(s,"EXIT all Short positions\nif trading long positions, enter long Now-\nOR at the market price on tomorrow's Open with stop="+EncodeColor(4)+WriteVal(L+.75*ATR(5),1.4)+" ,","");
//WriteIf(ss,"exit all long positions today with a Market On Close (MOC) order\nOR at the market price on tomorrow's Open with stop="+EncodeColor(4)+WriteVal(Ref(H+.75*ATR(5), -1),1.4)+",","");
//WriteIf( sss ,"No trading signals today.","") ;

dist = 0.8*ATR(10);
dist1 = 2*ATR(10);
for( i = 0; i < BarCount; i++ )
{
if( Buy[i] )
{
PlotText( "\nBuy:" + L[ i ] + "\nT= " + (L[i]*1.005) + "\nSL= " + (L[i]*0.9975), i, L[ i ]-dist[i], colorGreen, colorWhite );
}
if( Sell[i] )
{
PlotText( "Sell:" + H[ i ] + "\nT= " + (H[i]*0.995) + "\nSL= " + (H[i]*1.0025), i, H[ i ]+dist1[i], colorRed, colorWhite );
}
}

Filter = s OR sss OR sss ;
AddColumn(C,"close",1.2);
AddColumn( IIf( s, 66,1 ), "buy", formatChar, 1, bkcolor =IIf (s,colorYellow, colorPink ));
AddColumn( IIf( Ss, 83,1 ), "sell", formatChar, 1, bkcolor =IIf (Ss,colorPink, colorWhite ));
AddColumn( IIf( sss, 87,1 ), "wait", formatChar, 1, bkcolor =IIf (sss,colorYellow, colorRed ));

_SECTION_BEGIN("swing1");
no=20;
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
supres=IIf(avn==1,sup,res);
a=Cross(C,supres);
b=Cross(supres,C);
style = a * styleStaircase + b * styleStaircase;
PlotShapes(a,style, IIf(a,colorGreen,colorRed), 0, IIf(a,Low,High));
Plot(supres,"Swing",colorYellow,styleStaircase);
_SECTION_END();

_SECTION_BEGIN("trend");
uptrend=PDI(20)>MDI(10)AND Signal(29)<MACD(13);
downtrend=MDI(10)>PDI(20)AND Signal(29)>MACD(13);
Plot( 2, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptrend, colorGreen, IIf( downtrend, colorRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();
Buy = s AND a AND uptrend ;
Short = ss AND b AND downtrend ;
Sell = ss AND b AND downtrend ;
Cover = s AND a AND uptrend ;
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Cover=ExRem(Cover,Short);
Short=ExRem(Short,Cover);
Filter=Buy OR Sell;
Filter= Cover OR Short;
AddColumn( Buy, "Buy", 1);
AddColumn(Sell, "Sell", 1);
AddColumn(Close,"Close",1.2);
AddColumn(Volume,"Volume",1.0);

// Plot the Buy and Sell arrows.
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-10);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-20);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-15);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=20);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25);


//plot volume graph
// set background gradient colours
SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 172,172,172 )),ParamColor("BgBottom", ColorRGB( 102,136,187 )),ParamColor("titleblock",ColorRGB( 255,255,255 )));
GraphXSpace = 5;
 
 
  • Post #16
  • Quote
  • Dec 26, 2016 12:35pm Dec 26, 2016 12:35pm
  •  ramzam
  • Joined Nov 2015 | Status: Member | 2,927 Posts
no one help over here.. .
Success is a Journey Not a Destination....... kind regards ramzam
 
 
  • Post #17
  • Quote
  • Aug 23, 2017 12:20am Aug 23, 2017 12:20am
  •  Mrodri
  • | Joined Mar 2010 | Status: Junior Member | 2 Posts
Can anyone here decompile an afi file; then convert the file to MQ4? If so; then please PM me?
Attached Image (click to enlarge)
Click to Enlarge

Name: Indicator.PNG
Size: 92 KB
 
 
  • Post #18
  • Quote
  • Aug 23, 2017 11:18am Aug 23, 2017 11:18am
  •  Mrodri
  • | Joined Mar 2010 | Status: Junior Member | 2 Posts
I have the code, no need to decompile. Can anyone help to make it into an MQ4?
 
 
  • Post #19
  • Quote
  • May 8, 2019 5:42am May 8, 2019 5:42am
  •  ramzam
  • Joined Nov 2015 | Status: Member | 2,927 Posts
i also have one file to make mqq4 from afl
Success is a Journey Not a Destination....... kind regards ramzam
 
 
  • Post #20
  • Quote
  • May 9, 2019 10:04am May 9, 2019 10:04am
  •  mladen
  • Joined Apr 2007 | Status: ... | 782 Posts
Quoting Mrodri
Disliked
Can anyone here decompile an afi file; then convert the file to MQ4? If so; then please PM me? {image}
Ignored
That is simply super trend indicator. Exists for a long time on MT
 
1
  • Platform Tech
  • /
  • Convert afl file to mq4 file
  • Reply to Thread
    • Page 1 2
    • Page 1 2
0 traders viewing now
  • More
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2022