How to use this site

Search the forum

It is good idea to search the forum before asking same questions over and over. To search the forum just use magnifying glass icon in the upper right corner

Also it is good idea to use Google and add to your search term to limit the output to content of web site. Doing so will include results from Knowledge Base and Users' Guide

Enter the AFL code properly

It is of utmost importance as improperly formatted code results in syntax errors.

Start code block with three back-ticks ``` and end the code block with three back-ticks too, like shown below. All you need to do is to

Just press </> button then paste or type your formula.


Send your question ONCE and only in ONE channel

If you sent your question on the forum, don't send the same question over email to support and vice versa, if you sent the email to support, don't send on the forum. Creating duplicates means a lot of unnecessary work for us and is considered vandalism. Duplicates are deleted without notice.

Make your question clear and provide necessary information

When asking a question, imagine yourself as you were to answer your question. Is your question clear enough? Does it include ALL necessary information (screenshots, formula) that is required for person who wants to help you, to know what the problem is, without seeing your computer screen? Do not leave the room for the guessing work.

Be polite when asking questions. Use proper grammar and avoid spelling mistakes.

Adding Screenshots or Other Media to Your Post

If you wish to use a screenshot in your post to clarify your issue, first capture it using the built-in Windows Snipping Tool or other screen capture software such as Pickpic (freeware). You can also create short animated GIFs to illustrate your issue using ScreenToGif (donationware).

Make sure to trim and/or optimize your picture for size before uploading. The forum will NOT accept uploads greater than 1MB and 5megapixels in size. Do NOT use phone camera to take screenshots.

To place an image in your post, copy it to your Windows clipboard, then simply paste it to your post by pressing CTRL-V on your keyboard, and it will be added and displayed at the current cursor position.

This also works if you paste URL links to images, documents or other media stored online, plus URLs of videos from hosts such as YouTube.

Use AmiBroker 6.0 or higher

Versions lower than 6.0 are not supported.

Do not post links to DLL plugins or other 3rd party executables

For security reasons we do not allow posting links to DLLs (plugins) or third party executables. Posts containing those will be deleted.

Accessing Your Preferences page

  • Click on your account icon (upper right corner with your avatar or first letter of your name)
  • Click on the Preferences button

Alternatively you can navigate to: (works only if you are logged in)

Changing black theme to white

In your Preferences, click on Interface and change Theme there to "Default" which is white theme

Changing e-mail preferences

In your Preferences, click on EMail and you will see plenty of email settings there

Accessing forum from dedicated Discourse mobile app


Of course you can just use web browser on your mobile phone

How to watch category - see this

Other basic operations - see this

Keyboard shortcuts

How to receive email copies of all posts?
Important plea to fellow members
Overlay an indicator and adjust the scale and position
Index Filters (FOREIGN)
Custom BackTest
AFL Optimizer help
Exploration Description detail
Nested IIF query
Find out Highest High and Lowest Low value from a specific date Range
Up down trendline with support resistance cross
ALERTIF - Replacing C with H
Support and Resistance not working
AFL coding education
Rotational System with Market Filter and Modified Exit
Exploration to find stocks
How to visually identify days of the week on intraday charts? Background color change for each separate day
Sell at second profitable opening
Repetitve emails in realtime when using send email function
Exploration Toolbar Buttons
AddToComposite multiplies Close by four
Two timeframe AFL
Matrix comparison
Weird Difference between Explore & Backtest
An array issue with NormDist function
Plot shapes don't appear on charts
Export Image > Tools > Customize >Tools ...Error?
Scale-in Quantity to be sold in lumsum
Slope of TrendLineDown
Hello from the Netherlands
Iterate through all files in a folder
Error 706: Show arrows feature needs a trades list
User error, same file for many symbols, was:Not all rows written using fput
Applystop - stopModeRisk logic
Use of More Than One Category in Filter Settings for Backtest with Ranking
Stability of Stochastic Fisher Plot -- plot values flash "on and off"
Reading a string date into a matrix
Any chatting protocol/platform for Amibroker users?
*Var AND *(&Var) with gSite.GetStockArray
Using Sum or SumSince
String storing barbybar dynamically
How to find Up-Down Volume Ratio
Common and continous vwap
Find highest Volume in previous day in intraday timeframe
How to get Call and Put Open Interest on same chart
# of Open Positions in Account
# of Open Positions in Account
Asking about IF else statement
Need help with Vwap bands AFL Coding
Need help with Vwap bands AFL Coding
Problem with simple exploration
Back tester executing trades the same day signal is generated problem
Strategy on DMI
Syntax for Sell: Top Bollinger Band (20MA, 1Std Dev) Crosses 50 MA
How to get more previous daily candle
Sum all ranks in this formula
Ask ( Filter Most Recent Ticker in From To Dates
How to add commulative open intrest of a sector stocks
Eleminate fuction
Place order before candle close
GAP Up Intraday AFL - Adding Two Additional Conditions
Disable Auto- Padding in Staticvars?
Auto Trendlines AFL exploration coding help
Don't override Close array, was: Filter = Close>10
Yahoo Group Amibroker Join
User error, was: Multi Timeframe Explorer - Exploring interval is lowest TF
Formula without buy/sell rules, was: Error with Equity
How show different timeframe charts with different parameter of same AFL
Welcome to Discourse
Trades are not getting squared off - IntraDay, Suggest Correction in Code
WHY does my trade exit at second bar from entry
How to get High and Low of last 5minute candle in Hourly Chart
How to show the maximum profit of a Transaction in the backtest?
Find Close of previous HHV
How to include Short and Cover into my trading formula
Trades are not getting squared off correctly in Back-Testing
Hourly ATR and hourly change
Need Help on RSI and Chart
Puzzled by NumToStr function result
Duplicate: [Puzzle] iif + numtostr
Latest candle high is greater than last 5 candle high
Quick Volatility Contraction Pattern Calculation (VCP) Using Trendline Studies and AFL
Ichimoku system
Use of IIF in combination with GFXTXTOUT
How to close open positions at the end of the day (for daytraders)
Exploration query
Finding the highest volume on green and red candles
Close price below 5sma for 5 consecutive days
Mismatch value between indicator and timeframeset
Coding help needed for setting stop loss / exit
A scan for breaking a trend line?
Histogram greater than zero green and less than zero red
Buy sell arrows on RSI curve not coming
Metastock to AFL Amibroker
Pls help re Barsince Barcount? - count number of green bars for say the past nine bars (minute bars)
AFL to Telegram Messages -- Error Multiple MSG sent
My first AFL- A thread for newbie questions
My first AFL- A thread for newbie questions
Fix time fram indicater
Code help needed. Thanks
Does not provide proper signal
Using eTables with Amibroker
How to get Close Price 20 Seconds prior to high Volume tick
AB Portfolio Rotation CBT Level 1
How do I convert a watch-list of Future stocks to Cash Stocks?
Formatting large numbers
How to Build a customized DLL. Connect Amibroker and SPtrader
Shorter and Longer Bars
Study values change unexpectedly
Converting script and looking for suggestions....
Duplicate: Nested writeif not giving all outputs
How to create a filter as latest close greater than latest open +1 day ago high +one day ago close /3
Multiple Time Frame SAR
Multiple Time Frame SAR
How to create trades from year end to year end?
Buy Sell Exploration issue
Simple MACD crossover strategy
Using ALMA cross in AFL programming
Bollinger Bands Trend Indicator
Moving Average of RSI
AFL Coding help
AFL coding for Intraday - Back Testing
How do I graph an Exploration
Amiquote 4 for Indian Market
Adding Color to the graph lines
Difference in backtest and actual code execution
Fake histogram line in indicator
Lowest price within range
Trade sequence reset
Price change value & % change & lowest & highest Price in scan
AFL Buy Signals
Is it possible to navigate the desired date when double-clicking trade list?
Volume profile code modification
How to explore %ROC by Start Date to To Date
How to Change time frame in OLE Script
How to explore %ROC by Start Date to To Date
Amazon cloud is slow, was: Warning 901 chart incomplete. Rendering timeout reached (1500ms)
Scan Button Modification
Signals not coming though conditions met!
Fibonacci Extension AFL
Stock listed in Exploration when IF condition not met
scoreNoRotate, as documented, prevents new trades, was: Why rotational system is not trading
scoreNoRotate, as documented, prevents new trades, was: Why rotational system is not trading
Vigilant asset allocation
Duplicate: How Array is filled under different time frame?
Duplicate: How Array is filled under different time frame?
Duplicate: ApplyStop stopTypeLoss acting differently WalkForward vs. Backtest?
How to plot line only for first 30 mins i.e 9:00 to 9:30 AM
Nesting AFL code using #include statements
Please what code to make space Up, like code space down \n . Thanks very much
Default columns in the Analysis window
Help writing accutrack code
How to buy at the high/close of the retest candle?
Weird behaviour - variables arbitrarily rewritten
Searching Posts
Supply and demand
DayofWeek issues in a Rotation strategy
Limit to 200 barCount in loop
Simple Question - Backtest Won't Trade All Securities?
Plot Amibroker Line chart of 3 days
Afl squishes candlesticks - help please
Cant import data from ASCII file by using JS - OLE
Need to fine tune to this AFL
Synced scroll/zoom of Chart-Group (multi time frames), Watchlist scroll
Getting maximum of 6 arrays
Can't get correct ema(o,5) of 15 minutes frame time in chart 1 minute , why?
Duplicate: How to load NSE stocks tickers
I am writing a program that sums the open interest for three months, but no result is coming
How to ask a good question
Rsi oversold and over bought for max 10 days
Stop Loss changing dynamically
Help in understanding code part
SetCustomBacktestProc doesn't behave as indicated in AFL Function Reference
ZIG ZAG with VALUE BARS AFL needed please help
Support & Resistance
Support & Resistance
How to get the most traded area value of previous day intraday data
How to correct this code?
How to avoid LLV looking beyond the current bar
Requesting for help
AddColumn using date from Analysis window Filter Setting
How to reference any proceeding zig-zag trough
How to add standard deviation of profit and losses as a custom backtest metric
How to modify the positionssizearray in backtest
Using for loop to write AFL
Exploration to find Bullish Stock based on Stochastic Crossover & 200 Day Moving Average
Working with matrices - Ranking
AFL Code Error Problem
False Bar Stochastic
DUPLICATE: Array subscript out of range while run in explorer editor
How to get close prices of today's date
Create new graph in weekly timeframe
Using ref function
Not saving data into a file for last hour from analysis with auto repeat
Exit loop based on array condition
Buy top ranked symbols first
Extract number from matrix
Latest one minute candle is greater than the average of last 10 one minute candle AFL required
Using multiple apply stops
GET Oscillator Breakout
Scanner problem
How to program a kind of state machine in afl?
Replace toggle button in parameter window with GuiToggle button?
Add arrow above the 10 days, 20 days, 60 days and 120 days from today
Arrows above Price and volume bars for user defined dates
Before posting please read this
Built in Browser vs External. Custom toolbar buttons/shortcuts. Small icons instead of text buttons in the toolbar
Intraday bar identify
VWAP AFL warning 505: Division by zero
Read share from text file
How do I check the Number of Bars SInce Last Trade Exit and New Trade?
Buy stoploss order to buy above the high of the buy signal candle
Coding Help With Filter Entries Via Sectors
Highest Volume Bar - Intra day
Evaluating condition in AFL
How can I Show the input of this code as columns by Analysis (duplicate)
working all all ticker symbols
Edit equation How this code works Analysis in AmiBroker
Send orders to IB on next bar (Intraday)
Walk Forward Initial Capital Issue
ETF Rotational Problem
How to add Buy, Sell,Short, Cover for Algo trading
Range of first candle of each and every day
Fib with CCI plotting
Range of first candle of each and every day
Range of first candle of each and every day
ApplyStop Coding Issue
GroupID - how to use
How to trade through MT4 using Amibroker with Oanda
AFL some values are empty, need help please!
Want to understand the strategy behind this afl
Swing High / Swing Low AFL Code
Need help with programming the TB-F
How to code below strategy please help
When using SetForeign displayed chart name is incorrect?
Daily scans in Weekly time frame
Counting problem
AFL multi time frame explorer : Need help
AFL multi time frame explorer : Need help
Problem with Stop loss
About Fractal Indicator
Swing volume plotted as line thickness
Problem with export of quote times with DTN IQ Feed dat
How to write Portfolio Wise Target
Is it possible to use a Limit Buy Order with EOD data?
Previous Days First Bar High/Low
AFL Coding required
Relative Strength Ratio Using Add to Composite
Problem with timeframe setting in formula
Scan and write text files
Correlation() with variable range
Before posting please read this
Issue with Scale-in trades during drawdown
Suggest new categories
Range of first candle of each and every day
Combining Equity Curves into a portfolio
Need Help for Exploration
StochRSI in Amibroker to Match TOS StochRSI
How to automate testing a strategy on multiple symbols - time frame?
My code generating Repeated signals
Buy stocks with the smallest RSI values from a list
Normalised Moving Average
Help in Exploration in RSI divergence AFL
Value in text box will disappear GFX
SEND signals to CSV from AFL ,whats wrong with my code
AMA Calculations
Volume breakout code
Error 61 occurs even though no % sign in the codes / file's / symbol's name
How to plot different buy/sell signals for first and subsequent orders
Max open positions 10, but it is taking only 9
How to shorten this single line of code
One symbol exit(Sell) trigger entry(Buy) for two symbols
SetForeign obviously changes OHLC arrays, was: Plortext signal buy and sell
5 Point Stop but different USD results?
Last day of month
Conditional Plot() something or nothing
Using Explore to calculate cumulative total returns of symbols by rank
How to add this custom column about volume to backtest results
Creating AFL for MAB & MABW ( traders tips August 2021)
Iif, WriteIf coding error(s)
Foreign Function - with 2 Conditions - no result?
Hello every one help me on this code i try but its throw syntex error?
I want to plot EMA with RSI parameters

When making changes in your profile…


Otherwise the selected updates are lost.

Guess how I figured that one out (again!!).


I would like to known where the “stay logged in” box is located.

It’s a pain to keep logging in

It stays by default unless you clear cookies or log out

Might it be your browser?

I have read on other sites that it may at times be due to your browser. I am using Chrome (Win 10) on desktop and iPhone uses it own version of Safari and both stay logged in unless I deliberately “Log Out”.


PS wouldn’t this question be better on a different topic thread, like how to use the new forum (as this has nothing to do with “Suggest new categories”)?

Does the site permit us to load WORD files or PDF (or I guess even EXCEL) files? Or is it perhaps a security risk for user with respect to virus’ etc?

I have in the “learn afl” posts often referred to the many years of TASC articles (just the ones that TJ has coded into afl’s) as learning examples. And I keep a WORD document that I update each month with the title and date of the monthly “Trader’s Tips” article. I thought it may be of use to the forum to have the list of titles that would correspond to the codes found at, and then the community could add comments or reviews of any articles they found useful etc.

There would be no actual articles (respect copyright) but a list of titles and a line or two regarding the subject mater.

I could just “copy and paste” into a forum post the titles if anyone was interested and if no WORD/PDF 's are permitted but it would make for a very long post. Or of course if no one is interested just scrap the idea.


Yes there is a security risk about MS Office files that can contain macros and malicious content, but that is not the main issue. Posting PDF and Word docs is not recommended as their content can not be searched using forum search.
Opposed to Yahoo groups where search simply does not work, here search works nice and content can be found quickly using tags, categories, full text search and so on.


Selecting URL’s within Posts

Clicking on the URL takes you directly to the website address - and away from the Amibroker Community Forum. In other words you will have to click ‘Back’ to return to the forum.

Could I recommend that ‘clicking’ the URL automatically opens a newTab within the users browser? Thus retaining the forum display, and avoiding the necessity of using a right-button click and then clicking again to open the URL address.

1 Like

I particularly like the keyboard shortcut Shift-? which pops up the screen showing the keyboard shortcuts.
Shift-? for everyone! :beer:


Bluedog, opening URLs in a new tab is available as an option in your preferences.

Your avatar on the top right > Gear icon > Preferences > interface


Thanks for that HelixTrader - didn’t spot that one.

This software seems to have many bells and whistles, and I’m enjoying it far more than I ever did with Yahoo Groups.


Users' panel : the meaning of Topics Viewed versus Posts Read.

Concerning Users' panel :
I was searching for the meaning of Topics Viewed versus Posts Read.
I found the following

Humor is never far, the TechnoBear' second post is worth its weight of peanuts.

1 Like

“Flagging” vs “Bookmarking”?? Again, searched for answer on this, but found nothing. Searching seems like it is valuable for searching “User inputs/messages”. Searching on features of site not so much. Is there another site where they explain the details of Discourse and where searching will reveal answers to site use??

I so far have determined that “Bookmarking” seems to display (with g.b") all of MY bookmarks. That is good. What are flags and how do they work, their benefits, etc.?
Thanks again for helping me understand all of the features of this great forum. Such a pleasure after Yahoo Groups.

Flagging seems like a "bad" thing, i.e. someone has a problem with the post and is trying to get the OP attention, or the moderator.

And favorite vs Like vs Bookmark discussion,

I think these two posts summarize it well,

1 Like

A bug in code tag?

In the code listing below with code tag, note that the first "for" loop loses its indentation, but not the block inside.

if(Status("action") == actionPortfolio)
    bo = GetBacktesterObject();
    // Run default backtest procedure without generating the trade list
    // Initialize accumulation variables
    sumATRPnL =  countATRPnL = 0;
    sumATRPnLWin = countATRPnLWin = 0;
    sumATRPnLLoss = countATRPnLLoss = 0;
    maxATRPnL = minATRPnL = 0;

    // Iterate through closed trades
    for (trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade())
        ATRPnL = AddATRPnL(trade);

    // Iterate through open positions
    for (trade = bo.GetFirstOpenPos(); trade; trade = bo.GetNextOpenPos())
        ATRPnL = AddATRPnL(trade);

    // Generate trade list

    // Custom Statistics on ATR PnL
    avgATRPnL = IIf(countATRPnL < 1, 0.0, SumATRPnL / countATRPnL);
    avgATRPnLWin = IIf(countATRPnLWin < 1, 0.0, SumATRPnLWin / countATRPnLWin);
    avgATRPnLLoss = IIf(countATRPnLLoss < 1, 0.0, SumATRPnLLoss / countATRPnLLoss);
    bo.AddCustomMetric("Avg Trade (ATR)", avgATRPnL);
    bo.AddCustomMetric("Avg Win (ATR)", avgATRPnLWin);
    bo.AddCustomMetric("Avg Loss (ATR)", avgATRPnLLoss);
    bo.AddCustomMetric("ATR Profit Factor", -avgATRPnLWin / avgATRPnLLoss);
    bo.AddCustomMetric("Best Trade (ATR)", maxATRPnL);
    bo.AddCustomMetric("Worst Trade (ATR)", minATRPnL);

What it looks like in AFL Editor:

I’ve figured out a workaround to the formatting bug. AFL editor by default has no tab. However, the parser that parses the code tags assumes all following lines will follow that indentation. It’s a bug. The workaround is to have no blank lines a code block to preserve consistent indentation. One can use comment line to separate different logic sub-parts of a code block. Come of think of it, perhaps this is not a bug, but a feature to force programmer to comment code more. :wink:

A request/question to Tomasz: Is it possible to overwrite the 10 minute or no more edit setting currently in this forum? Being a slow but perfectionist editor means I often cannot make the deadline to fix up my posts – syntax, grammar, code formatting being the latest.