I FOUND THIS AFL CODE ... but WHEN APPLYING IT SHOWS THE "SYNTAX ERRORS " IN THE LINES OF 27,64,74,89,123,129,205 ERROR NUMBER 30
CAN ANYONE FIX THIS PROBLEM ?
CAN ANYONE FIX THIS PROBLEM ?
/*
ACE Nifty Futures Trading System - Version 1.1
Copyright : www.tradinganalysis.co.in, ACE Engravers
This system is written for Version 5.2 or 5.3 of AmiBroker Standard, Professional
or Ultimate Pack Pro Editions.
While every effort has been made for compatibility with previous versions,
some advanced features may be unavailable in previous Versions of AmiBroker.
If you are using versions prior to 5.20, kindly check the compatibility
and behaviour first.
*/
//============================Start of Chart Display Style=============================//
SetOption("EveryBarNullCheck", True);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} - O : %g, H : %g, L : %g, C : %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
SetChartOptions(0,chartShowArrows|chartShowDates | chartWrapTitle | chartLogarithmic);
_SECTION_BEGIN("Chart Display Theme");
ChartDisplayTheme = ParamList("Chart Display Theme", "White background with B/W candles|Black background with R/G candles",1);
param_ShowSystemTitle = ParamToggle("Show System Title ?","No|Yes",1);
_SECTION_END();
TA_ChartDisplayTheme(ChartDisplayTheme);
//============================End of Chart Display Style=============================//
//============================Take User Inputs=============================//
_SECTION_BEGIN("Alerts");
Param_AudioAlert = ParamToggle("Audio / text Alert?","No|Yes",1);
Param_ManualVoiceAlerts = ParamToggle("Alert in human voice?","No|Yes",1);
Param_AlertFrequency = Param("Audio Alert / human voice alert frequency?",10,5,1000,1);
Param_ShowValuesBox = ParamToggle("Display values in Box?","No|Yes",1);
Param_BoxLocation = ParamList("Box Location?", "Left Top|Left Bottom|Right Top|Right Bottom",0);
Param_BoxBackgroundColour = ParamColor("Box background colour?",colorDarkGrey);
Param_HideBoxBehindChart = ParamToggle("Hide Box behind Chart?", "No|Yes");
_SECTION_END();
_SECTION_BEGIN("Money Management");
Param_Show_Equity = ParamToggle("Show Equity ?(Enter correct INITIAL EQUITY in AA Settings)","No|Yes");
Param_Margin = Param("Margin required (used for backtesting only)", 15,0.001,100,0.001);
Param_LotSize = Param("Lot Size (used for backtesting only)", 50,5,5000,5);
Param_NoOfLots = Param("No of lots normally traded (used for backtesting only)",2,1,10000,1);
Param_drawdown=ParamList("Trailing Stoploss Method", "% of total trade value|Fixed amount per share");
Param_Stoploss_percent = Param("Stoploss % per trade", 0.7,0.01,5,0.01);
Param_Stoploss_amount = Param("Stoploss Amount per share", 15, 0.01,50000,0.01);
_SECTION_END();
//============================End of User Inputs=============================//
//==========================Start of Show Resistance and Support Lines===============================//
_SECTION_BEGIN("Support-Resistance");
Param_ShowResSup = ParamToggle("Show Resistance / Support ?","No|Yes");
Param_HowManyRS = Param("How many Support / Resistance to show ?",2,0,10,1);
Param_ResSupVolatility = Param("Support / Resistance Volatility ",0.1,0.1,100,0.1);
Param_SupLineColor = ParamColor("Support Line Color",colorBrightGreen);
Param_SupLineStyle = ParamStyle("Support Line Style", styleLine|styleNoTitle);
Param_ResLineColor = ParamColor("Resistance Line Color",colorRed);
Param_ResLineStyle = ParamStyle("Resistance Line Style", styleLine|styleNoTitle);
if(Param_ShowResSup AND Param_HowManyRS>0) TA_ShowSupportResistance(Param_HowManyRS,Param_ResSupVolatility,Param_SupLineColor,Param_ResLineColor,Param_SupLineStyle,Param_ResLineStyle);
_SECTION_END();
//===========End of Resistance and Support Lines===========//
_SECTION_BEGIN("Trading System");
//====================Show Reversals ?====================//
Param_ShowReversals = ParamToggle("Show possible reversals ?","No|Yes");
if(Param_ShowReversals) TA_ShowReversals();
//====================End of Show Reversals ?====================//
//====================Start of Trading System====================//
Param_ShowArrows = ParamToggle("Show Buy/Sell/Short/Cover Arrows ?","No|Yes",1);
firstBarEntryExit = ParamToggle("First bar trade entry / exit ?","No|Yes");
CloseDailyPosition = ParamToggle("Close Daily Position?","No|Yes");
ExitOnCandleNo = Param("If yes, exit on Candle No?",76,5,500);
A = Param("A - DO NOT change any Values",14,2,25,1);
B = Param("B - DO NOT change any Values",5,2,25,1);
CC = Param("C - DO NOT change any Values",5,1,25,1);
D = Param("D - DO NOT change any Values",5,1,25,1);
E = Param("E - DO NOT change any Values",18,1,20,1);
TA_TradingSystemCheckEntry(A,B,CC,D,E,firstBarEntryExit,CloseDailyPosition,ExitOnCandleNo);
_SECTION_END();
//Settings for Backtester
SetOption("AllowSameBarExit", False);
SetOption("AllowPositionShrinking", False);
SetOption("FuturesMode", True);
SetOption("InterestRate",0);
SetOption("MaxOpenPositions",1);
RoundLotSize = Param_LotSize;
SetOption("MinShares",RoundLotSize);
SetOption("PriceBoundChecking",False);
//SetOption("CommissionMode",3);
//SetOption("CommissionAmount",12.5/RoundLotSize);
SetOption("AccountMargin",Param_Margin);
SetOption("ReverseSignalForcesExit",True);
SetOption("UsePrevBarEquityForPosSizing",True);
SetOption("GenerateReport",1);
SetOption("MaxOpenLong",1);
SetOption("MaxOpenShort",1);
SetOption("RefreshWhenCompleted",True);
PositionSize = C*RoundLotSize*Param_NoOfLots;
SetTradeDelays(0,0,0,0);
BuyPrice = Close;
SellPrice = Close;
ShortPrice = Close;
CoverPrice = Close;
//End of Settings for Backtester
//====================End of Trading System====================//
//===================Start of money management=============================//
TA_TradingSystemCheckExit(Param_drawdown,Param_NoOfLots,Param_Stoploss_Percent,Param_Stoploss_amount,Param_LotSize,firstBarEntryExit,CloseDailyPosition,ExitOnCandleNo);
//==========================end of money management=============================//
//==================Plot Equity, Arrows, AudioAlerts and box containing values================//
TA_PlotEquityArrowsAlertsValueBox(Param_BoxLocation, Param_Show_Equity,Param_ShowArrows,Param_AudioAlert,Param_ManualVoiceAlerts, Param_AlertFrequency, param_ShowSystemTitle,Param_ShowValuesBox, Param_HideBoxBehindChart,Param_BoxBackgroundColour);
//=================== End of Plot Arrows, AudioAlerts and box containing values================//
//=================== Start of Volume Display================//
_SECTION_BEGIN("Volume Selector");
showVolume = ParamToggle("Show Volume ?", "No|Yes",1);
displayStyle = ParamList("Volume Display Mode", "Normal Volume|Coloured Volume|Volume at Price|Volume at Price (grouped)|Volume at Price + Volume|Volume at Price + Coloured Volume|Volume at Price (grouped) + Volume|Volume at Price (grouped) + Coloured Volume|Customised VAP / candles");
Param_NormalVolumeColor = ParamColor("Normal Volume Colour", colorDarkBlue);
Param_NormalVolumeStyle = ParamStyle( "Normal Volume Style", styleHistogram | styleOwnScale | styleNoLabel, maskHistogram );
Param_UpVolumeColor = ParamColor("Up Volume Colour", colorGreen);
Param_DownVolumeColor = ParamColor("Down Volume Colour", colorRed);
Param_ColouredVolumeStyle = ParamStyle( "Coloured Volume Style", styleHistogram | styleOwnScale | styleNoLabel, maskHistogram);
Param_VAPLinesCount = Param("VAP Lines Count", 100, 5, 1000, 1 );
Param_VAPLinesWidth = Param("VAP Lines Width", 40, 1, 100, 1 );
Param_VAPVolumeColor = ParamColor("VAP Color", colorGold);
Param_VAPSide = ParamToggle("VAP Side", "Left|Right" );
Param_VAPOverlay = 4*ParamToggle("VAP Z-order", "On top|Behind", 1 );
Param_VAPStyle = 2 * ParamToggle("VAP(grouped) Style", "Fill|Lines",1);
Param_Segment = Param("No. of candles for Customized VAP",10,2,1000,1);
if(showVolume)
{
segmentValue = IIf( Interval() < inDaily, Day(), Month() );
segmentValue = segmentValue != Ref( segmentValue, -1 );
if(displayStyle =="Normal Volume")
{
Plot( Volume, "Vol ", Param_NormalVolumeColor, Param_NormalVolumeStyle, 2);
}
else if(displayStyle == "Coloured Volume")
{
Plot( Volume, "Vol ", IIf( C > O, Param_UpVolumeColor,Param_DownVolumeColor), Param_ColouredVolumeStyle, 2);
}
else if (displayStyle =="Volume at Price")
{
PlotVAPOverlay( Param_VAPLinesCount , Param_VAPLinesWidth, Param_VAPVolumeColor, Param_VAPSide | Param_VAPOverlay );
}
else if (displayStyle=="Volume at Price (grouped)")
{
PlotVAPOverlayA(segmentValue, Param_VAPLinesCount, Param_VAPLinesWidth, Param_VAPVolumeColor, Param_VAPSide | Param_VAPStyle | Param_VAPOverlay);
}
else if (displayStyle =="Volume at Price + Volume")
{
Plot( Volume, "Vol ", Param_NormalVolumeColor, Param_NormalVolumeStyle, 2);
PlotVAPOverlay( Param_VAPLinesCount , Param_VAPLinesWidth, Param_VAPVolumeColor, Param_VAPSide | Param_VAPOverlay );
}
else if (displayStyle =="Volume at Price + Coloured Volume")
{
Plot( Volume, "Vol ", IIf( C > O, Param_UpVolumeColor,Param_DownVolumeColor), Param_ColouredVolumeStyle, 2);
PlotVAPOverlay( Param_VAPLinesCount , Param_VAPLinesWidth, Param_VAPVolumeColor, Param_VAPSide | Param_VAPOverlay );
}
else if (displayStyle=="Volume at Price (grouped) + Volume")
{
Plot( Volume, "Vol ", Param_NormalVolumeColor, Param_NormalVolumeStyle, 2);
PlotVAPOverlayA(segmentValue, Param_VAPLinesCount, Param_VAPLinesWidth, Param_VAPVolumeColor, Param_VAPSide | Param_VAPStyle | Param_VAPOverlay);
}
else if (displayStyle=="Volume at Price (grouped) + Coloured Volume")
{
Plot( Volume, "Vol ", IIf( C > O, Param_UpVolumeColor,Param_DownVolumeColor), Param_ColouredVolumeStyle, 2);
PlotVAPOverlayA(segmentValue, Param_VAPLinesCount, Param_VAPLinesWidth, Param_VAPVolumeColor, Param_VAPSide | Param_VAPStyle | Param_VAPOverlay);
}
else if(displayStyle=="Customised VAP / candles") TA_ShowCustomizedVAP(Param_Segment,Param_VAPLinesCount, Param_VAPLinesWidth, Param_VAPVolumeColor, Param_VAPSide,Param_VAPStyle,Param_VAPOverlay);
_SECTION_END();
}
//=================== End of Volume Display================//
ACE Nifty Futures Trading System - Version 1.1
Copyright : www.tradinganalysis.co.in, ACE Engravers
This system is written for Version 5.2 or 5.3 of AmiBroker Standard, Professional
or Ultimate Pack Pro Editions.
While every effort has been made for compatibility with previous versions,
some advanced features may be unavailable in previous Versions of AmiBroker.
If you are using versions prior to 5.20, kindly check the compatibility
and behaviour first.
*/
//============================Start of Chart Display Style=============================//
SetOption("EveryBarNullCheck", True);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} - O : %g, H : %g, L : %g, C : %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
SetChartOptions(0,chartShowArrows|chartShowDates | chartWrapTitle | chartLogarithmic);
_SECTION_BEGIN("Chart Display Theme");
ChartDisplayTheme = ParamList("Chart Display Theme", "White background with B/W candles|Black background with R/G candles",1);
param_ShowSystemTitle = ParamToggle("Show System Title ?","No|Yes",1);
_SECTION_END();
TA_ChartDisplayTheme(ChartDisplayTheme);
//============================End of Chart Display Style=============================//
//============================Take User Inputs=============================//
_SECTION_BEGIN("Alerts");
Param_AudioAlert = ParamToggle("Audio / text Alert?","No|Yes",1);
Param_ManualVoiceAlerts = ParamToggle("Alert in human voice?","No|Yes",1);
Param_AlertFrequency = Param("Audio Alert / human voice alert frequency?",10,5,1000,1);
Param_ShowValuesBox = ParamToggle("Display values in Box?","No|Yes",1);
Param_BoxLocation = ParamList("Box Location?", "Left Top|Left Bottom|Right Top|Right Bottom",0);
Param_BoxBackgroundColour = ParamColor("Box background colour?",colorDarkGrey);
Param_HideBoxBehindChart = ParamToggle("Hide Box behind Chart?", "No|Yes");
_SECTION_END();
_SECTION_BEGIN("Money Management");
Param_Show_Equity = ParamToggle("Show Equity ?(Enter correct INITIAL EQUITY in AA Settings)","No|Yes");
Param_Margin = Param("Margin required (used for backtesting only)", 15,0.001,100,0.001);
Param_LotSize = Param("Lot Size (used for backtesting only)", 50,5,5000,5);
Param_NoOfLots = Param("No of lots normally traded (used for backtesting only)",2,1,10000,1);
Param_drawdown=ParamList("Trailing Stoploss Method", "% of total trade value|Fixed amount per share");
Param_Stoploss_percent = Param("Stoploss % per trade", 0.7,0.01,5,0.01);
Param_Stoploss_amount = Param("Stoploss Amount per share", 15, 0.01,50000,0.01);
_SECTION_END();
//============================End of User Inputs=============================//
//==========================Start of Show Resistance and Support Lines===============================//
_SECTION_BEGIN("Support-Resistance");
Param_ShowResSup = ParamToggle("Show Resistance / Support ?","No|Yes");
Param_HowManyRS = Param("How many Support / Resistance to show ?",2,0,10,1);
Param_ResSupVolatility = Param("Support / Resistance Volatility ",0.1,0.1,100,0.1);
Param_SupLineColor = ParamColor("Support Line Color",colorBrightGreen);
Param_SupLineStyle = ParamStyle("Support Line Style", styleLine|styleNoTitle);
Param_ResLineColor = ParamColor("Resistance Line Color",colorRed);
Param_ResLineStyle = ParamStyle("Resistance Line Style", styleLine|styleNoTitle);
if(Param_ShowResSup AND Param_HowManyRS>0) TA_ShowSupportResistance(Param_HowManyRS,Param_ResSupVolatility,Param_SupLineColor,Param_ResLineColor,Param_SupLineStyle,Param_ResLineStyle);
_SECTION_END();
//===========End of Resistance and Support Lines===========//
_SECTION_BEGIN("Trading System");
//====================Show Reversals ?====================//
Param_ShowReversals = ParamToggle("Show possible reversals ?","No|Yes");
if(Param_ShowReversals) TA_ShowReversals();
//====================End of Show Reversals ?====================//
//====================Start of Trading System====================//
Param_ShowArrows = ParamToggle("Show Buy/Sell/Short/Cover Arrows ?","No|Yes",1);
firstBarEntryExit = ParamToggle("First bar trade entry / exit ?","No|Yes");
CloseDailyPosition = ParamToggle("Close Daily Position?","No|Yes");
ExitOnCandleNo = Param("If yes, exit on Candle No?",76,5,500);
A = Param("A - DO NOT change any Values",14,2,25,1);
B = Param("B - DO NOT change any Values",5,2,25,1);
CC = Param("C - DO NOT change any Values",5,1,25,1);
D = Param("D - DO NOT change any Values",5,1,25,1);
E = Param("E - DO NOT change any Values",18,1,20,1);
TA_TradingSystemCheckEntry(A,B,CC,D,E,firstBarEntryExit,CloseDailyPosition,ExitOnCandleNo);
_SECTION_END();
//Settings for Backtester
SetOption("AllowSameBarExit", False);
SetOption("AllowPositionShrinking", False);
SetOption("FuturesMode", True);
SetOption("InterestRate",0);
SetOption("MaxOpenPositions",1);
RoundLotSize = Param_LotSize;
SetOption("MinShares",RoundLotSize);
SetOption("PriceBoundChecking",False);
//SetOption("CommissionMode",3);
//SetOption("CommissionAmount",12.5/RoundLotSize);
SetOption("AccountMargin",Param_Margin);
SetOption("ReverseSignalForcesExit",True);
SetOption("UsePrevBarEquityForPosSizing",True);
SetOption("GenerateReport",1);
SetOption("MaxOpenLong",1);
SetOption("MaxOpenShort",1);
SetOption("RefreshWhenCompleted",True);
PositionSize = C*RoundLotSize*Param_NoOfLots;
SetTradeDelays(0,0,0,0);
BuyPrice = Close;
SellPrice = Close;
ShortPrice = Close;
CoverPrice = Close;
//End of Settings for Backtester
//====================End of Trading System====================//
//===================Start of money management=============================//
TA_TradingSystemCheckExit(Param_drawdown,Param_NoOfLots,Param_Stoploss_Percent,Param_Stoploss_amount,Param_LotSize,firstBarEntryExit,CloseDailyPosition,ExitOnCandleNo);
//==========================end of money management=============================//
//==================Plot Equity, Arrows, AudioAlerts and box containing values================//
TA_PlotEquityArrowsAlertsValueBox(Param_BoxLocation, Param_Show_Equity,Param_ShowArrows,Param_AudioAlert,Param_ManualVoiceAlerts, Param_AlertFrequency, param_ShowSystemTitle,Param_ShowValuesBox, Param_HideBoxBehindChart,Param_BoxBackgroundColour);
//=================== End of Plot Arrows, AudioAlerts and box containing values================//
//=================== Start of Volume Display================//
_SECTION_BEGIN("Volume Selector");
showVolume = ParamToggle("Show Volume ?", "No|Yes",1);
displayStyle = ParamList("Volume Display Mode", "Normal Volume|Coloured Volume|Volume at Price|Volume at Price (grouped)|Volume at Price + Volume|Volume at Price + Coloured Volume|Volume at Price (grouped) + Volume|Volume at Price (grouped) + Coloured Volume|Customised VAP / candles");
Param_NormalVolumeColor = ParamColor("Normal Volume Colour", colorDarkBlue);
Param_NormalVolumeStyle = ParamStyle( "Normal Volume Style", styleHistogram | styleOwnScale | styleNoLabel, maskHistogram );
Param_UpVolumeColor = ParamColor("Up Volume Colour", colorGreen);
Param_DownVolumeColor = ParamColor("Down Volume Colour", colorRed);
Param_ColouredVolumeStyle = ParamStyle( "Coloured Volume Style", styleHistogram | styleOwnScale | styleNoLabel, maskHistogram);
Param_VAPLinesCount = Param("VAP Lines Count", 100, 5, 1000, 1 );
Param_VAPLinesWidth = Param("VAP Lines Width", 40, 1, 100, 1 );
Param_VAPVolumeColor = ParamColor("VAP Color", colorGold);
Param_VAPSide = ParamToggle("VAP Side", "Left|Right" );
Param_VAPOverlay = 4*ParamToggle("VAP Z-order", "On top|Behind", 1 );
Param_VAPStyle = 2 * ParamToggle("VAP(grouped) Style", "Fill|Lines",1);
Param_Segment = Param("No. of candles for Customized VAP",10,2,1000,1);
if(showVolume)
{
segmentValue = IIf( Interval() < inDaily, Day(), Month() );
segmentValue = segmentValue != Ref( segmentValue, -1 );
if(displayStyle =="Normal Volume")
{
Plot( Volume, "Vol ", Param_NormalVolumeColor, Param_NormalVolumeStyle, 2);
}
else if(displayStyle == "Coloured Volume")
{
Plot( Volume, "Vol ", IIf( C > O, Param_UpVolumeColor,Param_DownVolumeColor), Param_ColouredVolumeStyle, 2);
}
else if (displayStyle =="Volume at Price")
{
PlotVAPOverlay( Param_VAPLinesCount , Param_VAPLinesWidth, Param_VAPVolumeColor, Param_VAPSide | Param_VAPOverlay );
}
else if (displayStyle=="Volume at Price (grouped)")
{
PlotVAPOverlayA(segmentValue, Param_VAPLinesCount, Param_VAPLinesWidth, Param_VAPVolumeColor, Param_VAPSide | Param_VAPStyle | Param_VAPOverlay);
}
else if (displayStyle =="Volume at Price + Volume")
{
Plot( Volume, "Vol ", Param_NormalVolumeColor, Param_NormalVolumeStyle, 2);
PlotVAPOverlay( Param_VAPLinesCount , Param_VAPLinesWidth, Param_VAPVolumeColor, Param_VAPSide | Param_VAPOverlay );
}
else if (displayStyle =="Volume at Price + Coloured Volume")
{
Plot( Volume, "Vol ", IIf( C > O, Param_UpVolumeColor,Param_DownVolumeColor), Param_ColouredVolumeStyle, 2);
PlotVAPOverlay( Param_VAPLinesCount , Param_VAPLinesWidth, Param_VAPVolumeColor, Param_VAPSide | Param_VAPOverlay );
}
else if (displayStyle=="Volume at Price (grouped) + Volume")
{
Plot( Volume, "Vol ", Param_NormalVolumeColor, Param_NormalVolumeStyle, 2);
PlotVAPOverlayA(segmentValue, Param_VAPLinesCount, Param_VAPLinesWidth, Param_VAPVolumeColor, Param_VAPSide | Param_VAPStyle | Param_VAPOverlay);
}
else if (displayStyle=="Volume at Price (grouped) + Coloured Volume")
{
Plot( Volume, "Vol ", IIf( C > O, Param_UpVolumeColor,Param_DownVolumeColor), Param_ColouredVolumeStyle, 2);
PlotVAPOverlayA(segmentValue, Param_VAPLinesCount, Param_VAPLinesWidth, Param_VAPVolumeColor, Param_VAPSide | Param_VAPStyle | Param_VAPOverlay);
}
else if(displayStyle=="Customised VAP / candles") TA_ShowCustomizedVAP(Param_Segment,Param_VAPLinesCount, Param_VAPLinesWidth, Param_VAPVolumeColor, Param_VAPSide,Param_VAPStyle,Param_VAPOverlay);
_SECTION_END();
}
//=================== End of Volume Display================//
Last edited: