indiTraders - Forum for the Active Indian Trader  

Go Back   indiTraders - Forum for the Active Indian Trader > Tools > Software > MetaTrader

Reply
 
Bookmark and Share LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 14-05-2013, 05:09 PM
ayush2020 ayush2020 is offline
Regular
 
Join Date: Sep 2011
Posts: 35
Thanks: 27
Thanked 2 Times in 1 Post
ayush2020 is on a distinguished road
Default can any one convert this AFL to ex4 (metatrader) formula

Code:
_SECTION_BEGIN("Trend Lines");
p1 = Param("TL 1 Periods", 20, 5, 50, 1);
p2 = Param("TL 2 Periods", 5, 3, 25, 1);
TL1 = LinearReg(C, p1);
TL2 = EMA(TL1, p2);
Col1 = IIf(TL1 > TL2, ParamColor("TL Up Colour", colorGreen), ParamColor("TL Dn Colour", colorRed));
Plot(TL1, "TriggerLine 1", Col1, styleLine|styleThick|styleNoLabel);
Plot(TL2, "TriggerLine 2", Col1, styleLine|styleThick|styleNoLabel);
_SECTION_END();

_SECTION_BEGIN("Linear Regression Channel");
//CyberMan's Linear Regression Channel.

//Linear Regression Line with 2 Standard Deviation Channels Plotted Above and Below
//The original was written by Patrick Hargus, with critical hints from Marcin Gorzynski, Amibroker.com Technical Support
//Wysiwyg coded the angle in degrees part
//I modified the original Linear Regression code so that the line will change color based on the degree of the Linear Regression slope.
//I combine this with my trading system.
//When my system gives an entry signal I look at the Linear Regression Line and I will only take long positions if the Linear Regression line is green and the entry price is below the LR line.
//When my system gives an entry signal I look at the Linear Regression Line and I will only take short positions if the Linear Regression line is red and the entry price is above the LR line.
//It is usefull for filtering out lower probability trades.


//================================================St art Chart Configuration===================================== =======================================

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 )) ));
SetChartBkGradientFill(ParamColor("Top", colorTeal), ParamColor("Bottom", colorLightGrey), ParamColor("Title", colorTeal));
SetChartBkColor(colorTeal);


Plot( C, "Close", colorWhite, styleCandle, Zorder = 1);
SetChartOptions(0,chartShowArrows | chartShowDates);

//================================================En d Chart Configuration===================================== ==========================================


//====================================Start of Linear Regression Code============================================== ====================================

P = ParamField("Price field",-1);

Length = 150;

Daysback = Param("Period for Liner Regression Line",Length,1,240,1);
shift = Param("Look back period",0,0,240,1);

//=============================== Math Formula ================================================== ================================================== ====

x = Cum(1);
lastx = LastValue( x ) - shift;
aa = LastValue( Ref(LinRegIntercept( p, Daysback), -shift) );
bb = LastValue( Ref(LinRegSlope( p, Daysback ), -shift) );
y = Aa + bb * ( x - (Lastx - DaysBack +1 ) );

//==================Plot the Linear Regression Line ================================================== ==================================================

LRColor = ParamColor("LR Color", colorCycle );
LRStyle = ParamStyle("LR Style");

LRLine = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y, Null );

LRStyle = ParamStyle("LR Style");
Angle = Param("Angle", 0.05, 0, 1.5, 0.01);// A slope higher than 0.05 radians will turn green, less than -0.05 will turn red and anything in between will be white.

LRLine = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y, Null );

Pi = 3.14159265 * atan(1); // Pi
SlopeAngle = atan(bb)*(180/Pi);

LineUp = SlopeAngle > Angle;
LineDn = SlopeAngle < - Angle;

if(LineUp)
{
Plot(LRLine, "Lin. Reg. Line Up", IIf(LineUp, colorBrightGreen, colorWhite), LRStyle);
}
else
{
Plot(LRLine, "Lin. Reg. Line Down", IIf(LineDn, colorDarkRed, colorWhite), LRStyle);
}

//========================== Plot 1st SD Channel ================================================== ================================================== ==

SDP = Param("Standard Deviation", 1.5, 0, 6, 0.1);
SD = SDP/2;

width = LastValue( Ref(SD*StDev(p, Daysback),-shift) ); //Set width of inside chanels here.
SDU = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y+width , Null ) ;
SDL = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y-width , Null ) ;

SDColor = ParamColor("SD Color", colorCycle );
SDStyle = ParamStyle("SD Style");

Plot( SDU , "Upper Lin Reg", colorWhite,SDStyle ); //Inside Regression Lines
Plot( SDL , "Lower Lin Reg", colorWhite,SDStyle ); //Inside Regression Lines

//========================== Plot 2d SD Channel ================================================== ================================================== ====

SDP2 = Param("2d Standard Deviation", 2.0, 0, 6, 0.1);
SD2 = SDP2/2;

width2 = LastValue( Ref(SD2*StDev(p, Daysback),-shift) ); //Set width of outside chanels here.
SDU2 = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y+width2 , Null ) ;
SDL2 = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y-width2 , Null ) ;

SDColor2 = ParamColor("2 SD Color", colorCycle );
SDStyle2 = ParamStyle("2 SD Style");

Plot( SDU2 , "Upper Lin Reg", colorWhite,SDStyle2 ); //OutSide Regression Lines
Plot( SDL2 , "Lower Lin Reg", colorWhite,SDStyle2 ); //OutSide Regression Lines

Trend = IIf(LRLine > Ref(LRLine,-1),colorGreen,colorRed);//Changes LR line to green if sloping up and red if sloping down.

Plot( LRLine , "LinReg", Trend, LRSTYLE );

//============================ End Indicator Code =========



_SECTION_BEGIN("MAMA");
SetBarsRequired( 10000, 10000 );
SetChartOptions(0,chartShowArrows|chartShowDates);
prc = ( High + Low ) / 2;
fastlimit = 0.5;
slowlimit = 0.05;
pi=4*atan(1);
RTD=180/pi;
DTR=pi/180;

Cyclepart=Param("Alpha",0.5,0.1,1,0.1);

Smooth[0] = Period = Detrender[0] = I1[0] = Q1[0] = 0;
phase[0]=deltaphase[0]=MAMA[0]=FAMA[0]=0;
for ( i = 6; i < BarCount; i++ )
{
Smooth[i] = ( 4 * prc[i] + 3 * prc[i-1] + 2 * prc[i-2] + prc[i-3] ) / 10;
AmpCorr[i] = 0.075 * Period[i-1] + 0.54;
Detrender[i] = ( 0.0962 * Smooth[i] + 0.5769 * Smooth[i-2] - 0.5769 * Smooth[i-4] - 0.0962 * Smooth[i-6] ) * AmpCorr[i];
Q1[i] = ( 0.0962 * Detrender[i] + 0.5769 * Detrender[i-2] - 0.5769 * Detrender[i-4] - 0.0962 * Detrender[i-6] ) * AmpCorr[i];
I1[i] = Detrender[i-3];
if (I1[i] != 0) phase[i] = DTR*360/atan(q1[i]/I1[i]);
deltaphase[i]=phase[i-1]-phase[i];
if (deltaphase[i] <1) deltaphase[i]=1;
alpha[i]=fastlimit[i]/deltaphase[i];
if (alpha[i] < slowlimit[i]) alpha[i]=slowlimit[i];
MAMA[i]=alpha[i] * prc [i] +(1-alpha[i])*MAMA[i-1];
FAMA[i]=Cyclepart*alpha[i] * prc [i] +(1-Cyclepart*alpha[i])*FAMA[i-1];
}

_SECTION_END();

_SECTION_BEGIN("SYSTEM");
BuySetupValue=ValueWhen(Cross(MAMA,FAMA),H,1);
SellsetupValue=ValueWhen(Cross(FAMA,MAMA),L,1);
Buysetup =Cross(MAMA,FAMA) ;
Sellsetup = Cross(FAMA,MAMA);
Longa = Flip(Buysetup,Sellsetup);
shrta = Flip(Sellsetup,Buysetup);
Buy=Longa AND Cross(C,BuySetupValue);
Sell=shrta AND Cross(SellsetupValue,C);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
t1= Flip(Buy,Sell);
t2= Flip(Sell,Buy);
BPrice=ValueWhen(t1 AND Ref(t1,-1)==0,C,1);
SPrice=ValueWhen(t2 AND Ref(t2,-1)==0,C,1);
GraphXSpace = 5;
dist = 1.5*ATR(20);
for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "" + C[ i ], i, L[ i ]-dist[i], colorLime );
if( Sell[i] ) PlotText( "" + C[ i ], i, H[ i ]+dist[i], colorYellow );
}
_SECTION_END();
//=================TITLE============================ ================================================== ==================
_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorWhite)+ "MAMA Poistional System" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"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-BPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SPrice-C)+"","")+
WriteIf(Longa AND NOT Buy, "Trade : Long - Entry price Rs."+(BPrice),"")+
WriteIf(shrta AND NOT Sell, "Trade : Short - Entry price Rs."+(SPrice),"")+"\n"+
WriteIf(Longa AND NOT Buy, "Current Profit/Loss Rs."+(C-BPrice)+"","")+
WriteIf(shrta AND NOT Sell, "Current Profit/Loss Rs."+(SPrice-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);
_SECTION_END();
WriteVal(BuyPrice);
WriteVal(Longa);
WriteVal(t1);
WriteVal(SellPrice);
WriteVal(shrta);
_SECTION_END();
//=========================== Back ground Text ===================
_SECTION_BEGIN("Background text");
GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/6 );
GfxSetTextAlign( 6 );// center alignment
//GfxSetTextColor( ColorRGB( 60, 45, 80 ) );
GfxSetTextColor( ColorHSB( 42, 42, 42 ) );
//GfxSetTextColor( ColorHSB( 5, 5,242) );
GfxSetBkMode(0); // transparent
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/12 );
GfxSelectFont("Tahoma", Status("pxheight")/12 );
GfxTextOut( "", Status("pxwidth")/2, Status("pxheight")/3 );
GfxSelectFont("Tahoma", Status("pxheight")/20 );
GfxTextOut( "", Status("pxwidth")/2, Status("pxheight")/2 );
GfxSelectFont("Tahoma", Status("pxheight")/40);
GfxTextOut( "", Status("pxwidth")/7, Status("pxheight")/6);

_SECTION_END();
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 24-05-2013, 04:03 PM
ayush2020 ayush2020 is offline
Regular
 
Join Date: Sep 2011
Posts: 35
Thanks: 27
Thanked 2 Times in 1 Post
ayush2020 is on a distinguished road
Default

can any one make DLL file so that we can use password or expiry date ...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 24-05-2013, 07:42 PM
chokalingamr chokalingamr is offline
Regular
 
Join Date: Dec 2012
Posts: 10
Thanks: 1
Thanked 2 Times in 2 Posts
chokalingamr is on a distinguished road
Default

Code:
AFMisc.SectionBegin("var Trend Lines");
var p1 = AFTools.Param("TL 1 Periods", 20, 5, 50, 1);
var p2 = AFTools.Param("TL 2 Periods", 5, 3, 25, 1);
var TL1 = AFStat.LinearReg(Close, p1);
var TL2 = AFAvg.Ema(TL1, p2);
var Col1 = AFTools.Iif(TL1 > TL2, AFTools.ParamColor("TL Up Colour", Color.Green), AFTools.ParamColor("TL Dn Colour", Color.Red));
AFGraph.Plot(TL1, "TriggerLine 1", Col1, Style.Line|Style.Thick|Style.NoLabel);
AFGraph.Plot(TL2, "TriggerLine 2", Col1, Style.Line|Style.Thick|Style.NoLabel);
AFMisc.SectionEnd();

AFMisc.SectionBegin("Linear Regression Channel");
//CyberMan's Linear Regression Channel.

//Linear Regression Line with 2 Standard Deviation Channels Plotted Above and Below
//The original was written by Patrick Hargus, with critical hints from Marcin Gorzynski, Amibroker.com Technical Support
//Wysiwyg coded the angle in degrees part
//I modified the original Linear Regression code so that the line will change color based on the degree of the Linear Regression slope.
//I combine this with my trading system.
//When my system gives an entry signal I look at the Linear Regression Line and I will only take long positions if the Linear Regression line is green and the entry price is below the LR line.
//When my system gives an entry signal I look at the Linear Regression Line and I will only take short positions if the Linear Regression line is red and the entry price is above the LR line.
//It is usefull for filtering out lower probability trades.


//================================================St art Chart Configuration===================================== =======================================

AFGraph.SetChartOptions(0,ChartOptionFlag.ShowArrows|ChartOptionFlag.ShowDates);
 /* _N */ (Title = AFStr.StrFormat("{{AFInfo.Name}} - {{AFTimeFrame.Interval}} {{AFDate.Date}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) var Vol " +AFMisc.WriteVal( Volume, 1.0f ) +" {{VALUES}}", Open, High, Low, Close, AFMisc.SelectedValue( AFInd.Roc( Close, 1 )) ));
AFGraph.SetChartBkGradientFill(AFTools.ParamColor("Top", Color.Teal), AFTools.ParamColor("Bottom", Color.LightGrey), AFTools.ParamColor("Title", Color.Teal));
AFGraph.SetChartBkColor(Color.Teal);


AFGraph.Plot( Close, "Close", Color.White, Style.Candle, var Zorder = 1);
AFGraph.SetChartOptions(0,ChartOptionFlag.ShowArrows | ChartOptionFlag.ShowDates);

//================================================En d Chart Configuration===================================== ==========================================


//====================================Start of Linear Regression Code============================================== ====================================

var P = AFTools.ParamField("Price field",-1);

var Length = 150;

var Daysback = AFTools.Param("var Period for Liner Regression Line",Length,1,240,1);
var shift = AFTools.Param("Look back Period",0,0,240,1);

//=============================== Math Formula ================================================== ================================================== ====

var x = AFAvg.Cum(1);
var lastx = AFTools.LastValue( x ) - shift;
var aa = AFTools.LastValue( AFTools.Ref(AFStat.LinRegIntercept( P, Daysback), -shift) );
var bb = AFTools.LastValue( AFTools.Ref(AFStat.LinRegSlope( P, Daysback ), -shift) );
var y = aa + bb * ( x - (lastx - Daysback +1 ) );

//==================Plot the Linear Regression Line ================================================== ==================================================

var LRColor = AFTools.ParamColor("LR Color", Color.Cycle );
var LRStyle = AFTools.ParamStyle("LR Style");

var LRLine = AFTools.Iif( x > (lastx - Daysback) & AFDate.BarIndex() < lastx, y, ATFloat.Null );

LRStyle = AFTools.ParamStyle("LR Style");
Angle = AFTools.Param("Angle", 0.05f, 0, 1.5f, 0.01f);// A slope higher than 0.05 radians will turn green, less than -0.05 will turn red and anything in between will be white.

LRLine = AFTools.Iif( x > (lastx - Daysback) & AFDate.BarIndex() < lastx, y, ATFloat.Null );

var Pi = 3.14159265f * AFMath.Atan(1); // Pi
var SlopeAngle = AFMath.Atan(bb)*(180/Pi);

var LineUp = SlopeAngle > Angle;
var LineDn = SlopeAngle < - Angle;

/* Hint: convert float expression to bool using ATFloat.IsTrue(<float expression>) */
if(LineUp)
{
AFGraph.Plot(LRLine, "Lin. Reg. Line Up", AFTools.Iif(LineUp, Color.BrightGreen, Color.White), LRStyle);
}
else
{
AFGraph.Plot(LRLine, "Lin. Reg. Line Down", AFTools.Iif(LineDn, Color.DarkRed, Color.White), LRStyle);
}

//========================== Plot 1st SD Channel ================================================== ================================================== ==

var SDP = AFTools.Param("Standard Deviation", 1.5f, 0, 6, 0.1f);
SD = SDP/2;

var width = AFTools.LastValue( AFTools.Ref(SD*AFStat.StDev(P, Daysback),-shift) ); //Set width of inside chanels here.
var SDU = AFTools.Iif( x > (lastx - Daysback) & AFDate.BarIndex() < lastx, y+width , ATFloat.Null ) ;
var SDL = AFTools.Iif( x > (lastx - Daysback) & AFDate.BarIndex() < lastx, y-width , ATFloat.Null ) ;

var SDColor = AFTools.ParamColor("SD Color", Color.Cycle );
var SDStyle = AFTools.ParamStyle("SD Style");

AFGraph.Plot( SDU , "Upper Lin Reg", Color.White,SDStyle ); //Inside Regression Lines
AFGraph.Plot( SDL , "Lower Lin Reg", Color.White,SDStyle ); //Inside Regression Lines

//========================== Plot 2d SD Channel ================================================== ================================================== ====

var SDP2 = AFTools.Param("2d Standard Deviation", 2.0f, 0, 6, 0.1f);
var SD2 = SDP2/2;

var width2 = AFTools.LastValue( AFTools.Ref(SD2*AFStat.StDev(P, Daysback),-shift) ); //Set width of outside chanels here.
var SDU2 = AFTools.Iif( x > (lastx - Daysback) & AFDate.BarIndex() < lastx, y+width2 , ATFloat.Null ) ;
var SDL2 = AFTools.Iif( x > (lastx - Daysback) & AFDate.BarIndex() < lastx, y-width2 , ATFloat.Null ) ;

var SDColor2 = AFTools.ParamColor("2 SD Color", Color.Cycle );
var SDStyle2 = AFTools.ParamStyle("2 SD Style");

AFGraph.Plot( SDU2 , "Upper Lin Reg", Color.White,SDStyle2 ); //OutSide Regression Lines
AFGraph.Plot( SDL2 , "Lower Lin Reg", Color.White,SDStyle2 ); //OutSide Regression Lines

Trend = AFTools.Iif(LRLine > AFTools.Ref(LRLine,-1),Color.Green,Color.Red);//Changes LR line to green if sloping up and red if sloping down.

AFGraph.Plot( LRLine , "LinReg", Trend, LRStyle );

//============================ End Indicator Code =========



AFMisc.SectionBegin("MAMA");
AFMisc.SetBarsRequired( 10000, 10000 );
AFGraph.SetChartOptions(0,ChartOptionFlag.ShowArrows|ChartOptionFlag.ShowDates);
var prc = ( High + Low ) / 2;
var fastlimit = 0.5f;
var slowlimit = 0.05f;
Pi=4*AFMath.Atan(1);
var RTD=180/Pi;
var DTR=Pi/180;

var Cyclepart=AFTools.Param("Alpha",0.5f,0.1f,1,0.1f);

Smooth[0] = Period = Detrender[0] = I1[0] = Q1[0] = 0;
phase[0]=deltaphase[0]=MAMA[0]=FAMA[0]=0;
/* Hint: declare loop variable as int */ 
for ( i = 6; i < BarCount; i++ )
{
Smooth[i] = ( 4 * prc[i] + 3 * prc[i-1] + 2 * prc[i-2] + prc[i-3] ) / 10;
AmpCorr[i] = 0.075f * Period[i-1] + 0.54f;
Detrender[i] = ( 0.0962f * Smooth[i] + 0.5769f * Smooth[i-2] - 0.5769f * Smooth[i-4] - 0.0962f * Smooth[i-6] ) * AmpCorr[i];
Q1[i] = ( 0.0962f * Detrender[i] + 0.5769f * Detrender[i-2] - 0.5769f * Detrender[i-4] - 0.0962f * Detrender[i-6] ) * AmpCorr[i];
I1[i] = Detrender[i-3];
if (I1[i] != 0) phase[i] = DTR*360/AFMath.Atan(q1[i]/I1[i]);
deltaphase[i]=phase[i-1]-phase[i];
if (deltaphase[i] <1) deltaphase[i]=1;
alpha[i]=fastlimit[i]/deltaphase[i];
if (alpha[i] < slowlimit[i]) alpha[i]=slowlimit[i];
MAMA[i]=alpha[i] * prc [i] +(1-alpha[i])*MAMA[i-1];
FAMA[i]=Cyclepart*alpha[i] * prc [i] +(1-Cyclepart*alpha[i])*FAMA[i-1];
}

AFMisc.SectionEnd();

AFMisc.SectionBegin("SYSTEM");
var BuySetupValue=AFTools.ValueWhen(AFTools.Cross(MAMA,FAMA),High,1);
var SellsetupValue=AFTools.ValueWhen(AFTools.Cross(FAMA,MAMA),Low,1);
var Buysetup =AFTools.Cross(MAMA,FAMA) ;
var Sellsetup = AFTools.Cross(FAMA,MAMA);
var Longa = AFTools.Flip(Buysetup,Sellsetup);
var shrta = AFTools.Flip(Sellsetup,Buysetup);
Buy=Longa & AFTools.Cross(Close,BuySetupValue);
Sell=shrta & AFTools.Cross(SellsetupValue,Close);
Buy = AFTools.ExRem(Buy,Sell);
Sell = AFTools.ExRem(Sell,Buy);
var t1= AFTools.Flip(Buy,Sell);
var t2= AFTools.Flip(Sell,Buy);
var BPrice=AFTools.ValueWhen(t1 & AFTools.Ref(t1,-1)==0,Close,1);
var SPrice=AFTools.ValueWhen(t2 & AFTools.Ref(t2,-1)==0,Close,1);
GraphXSpace = 5;
var dist = 1.5f*AFInd.Atr(20);
/* Hint: declare loop variable as int */ 
for( i = 0; i < BarCount; i++ )
{
/* Hint: convert float expression to bool using ATFloat.IsTrue(<float expression>) */
if( Buy[i] ) AFGraph.PlotText( "" + Close[ i ], i, Low[ i ]-dist[i], Color.Lime );
if( Sell[i] ) AFGraph.PlotText( "" + Close[ i ], i, High[ i ]+dist[i], Color.Yellow );
}
AFMisc.SectionEnd();
//=================TITLE============================ ================================================== ==================
AFMisc.SectionBegin("Title");
/* Hint: convert float expression to bool using ATFloat.IsTrue(<float expression>) */
if( AFMisc.Status("action") == actionIndicator )
(
Title = AFMisc.EncodeColor(Color.White)+ "MAMA Poistional System" + " - " + AFInfo.Name() + " - " + AFMisc.EncodeColor(Color.Red)+ AFTimeFrame.Interval(2) + AFMisc.EncodeColor(Color.White) +
" - " + AFDate.Date() +" - "+"\n" +AFMisc.EncodeColor(Color.Yellow) +"Op-"+Open+" "+"Hi-"+High+" "+"Lo-"+Low+" "+
"Cl-"+Close+" "+ "Vol= "+ AFMisc.WriteVal(Volume)+"\n"+
AFMisc.EncodeColor(Color.Lime)+
AFMisc.WriteIf (Buy , " GO LONG / Reverse AFInd.Signal at "+Close+" ","")+
AFMisc.WriteIf (Sell , " EXIT LONG / Reverse AFInd.Signal at "+Close+" ","")+"\n"+AFMisc.EncodeColor(Color.White)+
AFMisc.WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(Close-BPrice)+"","")+
AFMisc.WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SPrice-Close)+"","")+
AFMisc.WriteIf(Longa & ! Buy, "Trade : Long - Entry price Rs."+(BPrice),"")+
AFMisc.WriteIf(shrta & ! Sell, "Trade : Short - Entry price Rs."+(SPrice),"")+"\n"+
AFMisc.WriteIf(Longa & ! Buy, "Current Profit/Loss Rs."+(Close-BPrice)+"","")+
AFMisc.WriteIf(shrta & ! Sell, "Current Profit/Loss Rs."+(SPrice-Close)+"",""));
AFGraph.PlotShapes(AFTools.Iif(Buy, Shape.Square, Shape.None),Color.Green, 0, Low, var Offset=-40);
AFGraph.PlotShapes(AFTools.Iif(Buy, Shape.Square, Shape.None),Color.Lime, 0,Low, Offset=-50);
AFGraph.PlotShapes(AFTools.Iif(Buy, Shape.UpArrow, Shape.None),Color.White, 0,Low, Offset=-45);
AFGraph.PlotShapes(AFTools.Iif(Sell, Shape.Square, Shape.None),Color.Red, 0, High, Offset=40);
AFGraph.PlotShapes(AFTools.Iif(Sell, Shape.Square, Shape.None),Color.Orange, 0,High, Offset=50);
AFGraph.PlotShapes(AFTools.Iif(Sell, Shape.DownArrow, Shape.None),Color.White, 0,High, Offset=-45);
AFMisc.SectionEnd();
AFMisc.WriteVal(BuyPrice);
AFMisc.WriteVal(Longa);
AFMisc.WriteVal(t1);
AFMisc.WriteVal(SellPrice);
AFMisc.WriteVal(shrta);
AFMisc.SectionEnd();
//=========================== Back ground Text ===================
AFMisc.SectionBegin("Background text");
AFGraph.GfxSetOverlayMode(1);
AFGraph.GfxSelectFont("Tahoma", AFMisc.Status("pxheight")/6 );
AFGraph.GfxSetTextAlign( 6 );// center alignment
//GfxSetTextColor( ColorRGB( 60, 45, 80 ) );
AFGraph.GfxSetTextColor( AFGraph.ColorHsb( 42, 42, 42 ) );
//GfxSetTextColor( ColorHSB( 5, 5,242) );
AFGraph.GfxSetBkMode(0); // transparent
AFGraph.GfxTextOut( AFInfo.Name(), AFMisc.Status("pxwidth")/2, AFMisc.Status("pxheight")/12 );
AFGraph.GfxSelectFont("Tahoma", AFMisc.Status("pxheight")/12 );
AFGraph.GfxTextOut( "", AFMisc.Status("pxwidth")/2, AFMisc.Status("pxheight")/3 );
AFGraph.GfxSelectFont("Tahoma", AFMisc.Status("pxheight")/20 );
AFGraph.GfxTextOut( "", AFMisc.Status("pxwidth")/2, AFMisc.Status("pxheight")/2 );
AFGraph.GfxSelectFont("Tahoma", AFMisc.Status("pxheight")/40);
AFGraph.GfxTextOut( "", AFMisc.Status("pxwidth")/7, AFMisc.Status("pxheight")/6);

AFMisc.SectionEnd();
the above is u r afl's c# code and it has many errors ,can anyone correct this?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 24-05-2013, 08:34 PM
cdjindia cdjindia is offline
Regulars
 
Join Date: Nov 2012
Posts: 132
Thanks: 277
Thanked 159 Times in 70 Posts
cdjindia will become famous soon enoughcdjindia will become famous soon enoughcdjindia will become famous soon enough
Default

This is hardly C# code. ayush. I can convert this for you in C++ (not C#) which you can place with AFL. If you distribute it to others, they will not be able to read thru code to understand the logic. I am assuming that you are not wanting to covnert the posted afl because it is far quite common
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to cdjindia For This Useful Post:
  #5 (permalink)  
Old 04-07-2013, 10:46 AM
ayush2020 ayush2020 is offline
Regular
 
Join Date: Sep 2011
Posts: 35
Thanks: 27
Thanked 2 Times in 1 Post
ayush2020 is on a distinguished road
Default

can any one make in to mt4 formula..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

indiTraders - Forum for the Active Indian Trader > Tools > Software > MetaTrader


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT +5.5. The time now is 09:56 PM.


vBulletin Copyright by vBulletin

Content Relevant URLs by vBSEO 3.3.2