How to ask a good question


Some people come here and ask single-line SMS-style question (plus sometimes some random code) and expect "solution" without showing any effort made from their side.

Then all the good souls on this forum hopelessly try to figure out "what the heck original poster meant?"

So please follow the tips below so your question is more likely to get proper answer.

How to ask a good question

  1. Follow the forum rules first: How to use this site

    Please use the search field in this forum, there are high chances that somebody already had the same problem and the answer is already available. If you have follow-up question, reply in existing thread instead of creating new topic.

  2. 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.

    Here are some tips:

  • what did you do?
  • what did you expect as a result?
  • why do you need that to happen?
  • what actually happened as a result instead?
  • what are the challenges?

    Be polite when asking questions. Use proper grammar and avoid spelling mistakes.
  1. Post the code that you wrote

    Use code tags so your formula is properly displayed. If the code produces some unexpected output, please include the snapshot of chart or Analysis and explain why do you think it is incorrect

    If you want to comment on somebody's else code you need to provide original reference (where did you get the code from)

  2. Give us all the background Information and explain the GOAL you want to accomplish

    Pretty often to give proper solution, it is very important to know why you want to do something. Usually there are dozens of ways to achieve the same thing and best solution depends on knowing exactly why you need to do something.

    Without knowing the background we are lost in our guesses and assumptions which may be totally incorrect and we will be wasting our time and your time too.

  3. Show your own effort

    It is important to state your skill level with AFL and general programming but emphasizing and starting posts using terms like newbie, amateur in return for free code will not help. Instead back yourself up with the research and links to manual and forum that you have read and tested.

Lastly, if you ever wanted longer advice on asking a good question you can find it here: (there is a lot of really good stuff there)

Stop Loss with a loop
ORB for previous day
Volume breakout of previous day 10min
How to stop re-entering the trade
Counting bars in in15Minute chart current day
Stop loss AFL code required
Volume breakout code
Modify code of gfx
Is there a better way to deal with Warning 512?
ASCII Files to Plugin creation
Exploration atr supertrend Need help
Objects in Amibroker
Buy & Sell Signal generation timing mismatch with the broker API
Problem of referencing (with better example)
Realtime composites
Updating composites in real time
customization of backtest works running "Optimise", not running "Backtest"
How to "hover and wait"
Problem of referencing (with better example)
Find longest line without any intersection
Add ( x,y) to change location in chart
Reverse Back testing
Values are not showing "correctly" when changed to weekly View
Settting a Sell Signal after x days if preferred signal not triggerd
HELP regarding backtesting of symbols retrieved from spot chart
Limits of multi-threading
ParamField built in function
ADX not showing for SOME symbols
Bollinger %b Function/Indicator
Amibroker shows AFL error but my editor does not
Add more then two true in TextSelector
Exploration results not right
Sample code required for Options Backtesting
Three basic code in English for each
Mxsortrows function
RTFM TimeFrame docs, was: Time in Result List not correct
RTFM TimeFrame docs, was: Time in Result List not correct
RTFM TimeFrame docs, was: Time in Result List not correct
Unknown Third party data plugin does not work
DDE Universal Data Plug-in Not showing in my data source
DDE Universal Data Plug-in Not showing in my data source
Adding value to cell manually
Please help to improve Amibroker AFL performance?
What is the optimal RAM?
Error 61 occurs even though no % sign in the codes / file's / symbol's name
Time Frame Optimization
Version for #runbatch
Problem: IB backfill 180days wipes out the saved intraday history
Calculations going wrong when zoom level changes
Strategy verification when using Equity()
Matrix code not working for large db
All time high and low with date stamp in the form of GfxTextOut...
Viewing monte carlo simulations on the backtest report
Issues with Custom CBT for Walk Forward Stats (using static variables)
Can some one help me to plot HIGHER LOW and LOWER HIGH on charts
How can I check if a variable has already been initialized?
Plotshapes works perfectly fine, was: does not work
One symbol exit(Sell) trigger entry(Buy) for two symbols
Analysis Window error
Deleting Composites
MacBook misbehaves, was: Define filter screen close prematurely
Calculate stoploss
Prevent Overlapping Trades (Portfolio Testing - Applystop)
Download OK, no chart
Unable to Scan/Explore/Backtest for IB symbols
Amibroker connect datafeed eSignal
How the delete quotes like this from all symbols
MacBook misbehaves, was: Define filter screen close prematurely
Need help in running the AFL faster
SetForeign obviously changes OHLC arrays, was: Plortext signal buy and sell
GFX Re-scale setting
Error Extracting Email Add On?
SetPositionSize - results
Different pad and align behaviour for setforign
ERROR 43: Variable stops are not supported in rotational and raw backtest modes
Return one value
Return one value
InWatchlist and MaxOpenPositions
Progress bar indicator
Chart size issues on different screens
Fetching cells in Amibroker analysis window
Fetching cells in Amibroker analysis window
AmiQuote - Fundamental - Extra - 'no key statistics' message
How to tell sunday trading is over - using expand last?
BTC Relative Price Percent Performance Chart
How to I save ticker list in .TLS extension
How to deal with warning 501
Intraday Mix EOD Data
I am facing strange issue in Batch Scheduler
Buy with multiple conditions
Scaleout rounding
Duplicate: Bars since price was this high/low
Amibroker Chart is showing Buy/Sell signals for a Weekly chart only
Send exploration result to watchlist
Modified include files do not trigger insert linked indicator reload
-nan(ind) in Backtest result
Modified include files do not trigger insert linked indicator reload
PositionSize based on a foreign array during backest
Gui and displaying values of indicator
Documentation example with scale in and scale out using a loop
Scheduler is too crowded, how to separate
Copy Amibroker from Win7-32 to Win10-64
Iif, WriteIf coding error(s)
Bracket Orders stay ApiPending / PreSubmitted
Second installation Amibroker
Rebalance portfolio weekly by cloasing all positions and opening new
Newbie needs AFL coding on SuperTrend and Donchian Channel
How to get current open positions and their symbol names
AmiBroker 6.39.1 RC released
Problems creating own Index with Norgate and store with AddToComposite
For loop : run previous three day issue and get error 10 message
Adding two StaticVar with array containing Null value and numbers
200 MA on <200 day old symbol
Why does a simple backtest take 35 secs to run? Or maybe rather 0.46sec?
Trade dates in Analysis window result table
Trade dates in Analysis window result table
Per-symbol web page, was: To add new fields in the Amibroker DB
Issue executing Daily Backtest on 5m Data base Interval
3rd party plugin problem, was: charting stuck
COVER signals differentiation
Flip(FirstEntry, Cover) when using Equity(1)
Sorry why on Amibroker I can't display the watchlist symbol as shown
Icon Size Is Still Too Small
Bullish/Bearish Outlook - Stocks in an Index above EMA 200
Trailing stop after "x" points price rises
GDI render Windows 7 vs Windows 10
Arranging the past 5 days close either in ascending or descending order
Set different BacktestMode, no difference. Why?
Break-Even stop with Point Mode activation floor
Break-Even stop with Point Mode activation floor
Double Zigzag to Creat Price Channel
Several windows user accounts for running multiple AmiBroker instances
Data access speed, not CPU, is often limiting factor, was: AmiBroker perf
Data access speed, not CPU, is often limiting factor, was: AmiBroker perf
Quick Keys for Scrolling charts
Multi buy/sell system backtester discrepancy
Facing issue for Intraday NR3 Breakout AFL
Unable to move past random TWS IB API Cancelled issue
Two timeframe AFL
Multi timeframe AFL
How to assign Past Bars Values in Array form with variable # of Past Bars?
Liquidity limit hit, was: SetPositionSize
Excel SumProduct Function
Show Trades Finding Random Dates
Excel SumProduct Function
Sector Rotation Strategy Using StaticVarSet and StaticVarGenerateRanks
Weird Difference between Explore & Backtest
Variable updates previous values (Expected behavior, need suggestions)
Bollinger Band With Conditions
Relative Strength, COMPARITVE
Implementing Excel's function SLOPE
Query amibroker db
WriteIf returns single string, was: Loop string for selection of Expiry
timeframegetprice not working
Question on valuewhen function
Export Image > Tools > Customize >Tools ...Error?
Reference previous value in a loop
Hello from the Netherlands
Not getting variable with staticvarget
Can Amibroker exit on price below stop when there is a gap?
User error, was: Cross Function Problem?
When we call OLE Automation Object, how to change chart file name?
Error 706: Show arrows feature needs a trades list
New ticker name - Not enough data available
Multi time frame filter in exploration
Filter Conditions with Explorer Filter
Exploration takes a long time once it reaches 100%
Different Filter Conditions with Explorer Filter
ApplyStop with stopTypeTrailing. How to continue the trade?
Best source of UK Data (FTSE all Share)
Horizontal line of lower timeframes don't appear on higher time frames
Calculate and plot average price per tick bar
Periodicitet dont show second
Duration for which a Stochastic signal stays at a particular point
Not subscribed to data, was: Unable to fill data from Interactive Broker plug-in
Compounding inside a for loop
Strategy Performance report issues when using "as-traded" prices
How to average down (buy when position value drops x percent)?
Why is the type of variable changing?
Exploration RSI Monthly with any of the 3 conditions
Calculate EMA ignoring Zero
Real life execution not matches backtest results
String storing barbybar dynamically
Ratching up interest in AmiBroker!
Text linebreak in Formula Editor
Slow optimizations with Norgate Data
Multiple sell tied to multiple buy
How to get stocks that doubled price since 52 week low
Buy and Short on the same bar with different entry and same exit
AFL Editor does not show commas etc
Quick Volatility Contraction Pattern Calculation (VCP) Using Trendline Studies and AFL
How to limit maximum number of trade shares?
Bad 'Integrity' data plugin causes problems, was: Exploration errors!
Bad 'Integrity' data plugin causes problems, was: Exploration errors!
How to expand Parameter dialog description box
How to get barssince a ApplyStop and what sell value the ApplyStop created
Poll: AFL Programming section
Limit the Number of Position Hold, Remove Excess Signal
Using Plot only on day session ( RTH )
Find OHLC of previous day 5 mins candle which made Day High
Help with Stop Loss condition on a trading strategy
Need help with Vwap bands AFL Coding
Need help with Vwap bands AFL Coding
Can Amibroker handle negative price?
Identify and fix the four bar high/low after a condition is met
Modify limitprice during backtesting procedure
Daily vs Monthly Exploration Results
Linear Regression between 2 or more symbols
stopModeRisk used for Buy and Short
Conversion of tradingview indicator
How to display Stop Loss values in the backtest trade list
Find the most recent Swing Low from the Entry
How to load same dll two instance
Error 321. An error occurred while validating the request:-"bq"
Asking about Back test and optimize Multiple symbols
Error 321. An error occurred while validating the request:-"bq"
Generate Signals using Watchlist as opposed to a Symbol
Tick data trading
Warning 901: chart incomplete, rendering timeout reached
Latest close greater than previous 15 min candle
Real-time Intraday Range Chart
Precision Problem with Setting GICS Code in AFL
Calculating half life for mean reverting series
Buy ans sell signal in same bar - Exploration
Need help printing 2 superimposed titles on a chart
Weekly Periodicity Setting Yields Only 1st Result for NASDAQ 100 Stocks
Support and resistane Based Volume
Support and resistane Based Volume
First, Second and Third Bar of Today's Chart
Don't override Close array, was: Filter = Close>10
Can't switching between Stock/Future mode
Seasonality indicator
How to create Moving Average Cross code afl
Quirky Datetime arithmetic in intraday chart
Help with StaticVarGet()
How to show MA5 value for last candle
Rt quote window & backfill
User error, was: Multi Timeframe Explorer - Exploring interval is lowest TF
Jake Bernstein code
Find Close of previous HHV
Simple indicator problem
Anchored VWAP Channel Problem
What is a COM object variable?
Upper circuit and lower circuit
Need Help on RSI and Chart
3 consecutive red close within a limited period
Check for squeeze in last 20 candles in 5 mins
Check for squeeze in last 20 candles in 5 mins
Latest candle high is greater than last 5 candle high
Quick Volatility Contraction Pattern Calculation (VCP) Using Trendline Studies and AFL
Latest candle high is greater than last 5 candle high
Ichimoku system
Short signal does not execute after Buy
How to close open positions at the end of the day (for daytraders)
Has anyone done some thing like one in red circles?
Backtest yields a single trade
Backtest yields a single trade
Not initializing variables correctly, was: "Buy" has a fractional value
Limit Explorer results and rearrange
IQfeed FXCM and realtime
Close price below 5sma for 5 consecutive days
Please help to make my code backtestable
Is it possible to draw like this?
AmiQuote 4.05 released
How to add Fundamental data from CVS ?. Thanks
AFL Formula Wizard not starting up
How do I correct this (Error 47)?
Plot Horizontal line from date to date ( Monday to Friday)
Subsetting data according to dates
Applystop problem
SMS Alert Component
Buy Short within a 8 Bars from Signal
Pause or Temporary Stop AFL Formula Refreshing/Executing
Buy Short within a 8 Bars from Signal
MACD histogram bar
Fix time fram indicater
Backtesting previously existing signals on new data
What is the most profitable trading strategy?
How to enter immediatly when break through the key price
Problem with IBController
Infrastructure as code?
Liquidity limit, was: partial fills on futures contracts within backtest
Importing bid AND offer prices?
Unexplained Exit and Entry on the Same Day with MaxOpenPositions = 1
LLV() of n period that is greater than 0
Same Entry Signal Type Closes Position
How do I convert a watch-list of Future stocks to Cash Stocks?
Incorrect CBT code, was: Differences between
Subscript using < issue
Count number of Peak/Trough in a period
GfxTextOut Problem
Repeated Buy signals and unusual sell signals
Intraday price and execution signals
Position value is expressed in base currency, was: Incorrect Position Value
Testing on multiple symbols with different commission rates
How to copy past closing price for my watch list for any past date?
AFL Optimizer help
Up down trendline with support resistance cross
An observation - Difference between two array values not consistent
ALERTIF - Replacing C with H
What will be point value in my case
Support and Resistance not working
How can carect this code
Rank the top 20 biggest ROC of HHV
Buy Sell Exploration issue
How to write the Alligator teeth in Amibroker?
Walk forward taking too long
Trade arrows not showing
Clean GFX code please
Code for Fibonacci
Find first and last bar within two price values
Could I prevent auto download quotes when run auto update quotes , and skip zero volume quotes from yahoo data source
styleOwnScale used incorrectly, was: MACD Histogram looses 0-axis
Auto Sizing Plot styleNoRescale
Blink Chart Issue
Using K-Ratio in PositionScore?
Calculate metrics during backtest
Moving average of RSI (Exploration)
Moving average of RSI (Exploration)
eSignal Volume data on AmiBroker
Daily CFD interest AFL code
How to add US symbols and categories
Matrix as argument for user-defined function
Adding Color to the graph lines
Need perfect afl with scanner
GANN HILO indicator
Watchlists missing
Limitations of the IEEE floating point standard and BarIndex(), iterator for loop
Profit taking in percentage
Price change value & % change & lowest & highest Price in scan
IQfeed daily data only get data back to 2016?
Reading manual is recommended - styleOwnScale, was: Scaling issue ,The price not match
Volume Profile (per swing)
COM object variable is not initialized or has invalid type
Problem with the "MetaStock importer"
AFL Buy Signals
EOD Backtesting help needed
Foreign symbol data padding, was: No data days problem
Can I get help on setting DDE connection from Excel to AmiBroker
Trouble with backtest
previous week high breakout explorer needed
Amiquote on Multiple Desktops
Create an Ichimoku Trend Line
Random code copy-pasted from the Internet does not work, was: Dear Sir and Senior
Backtesting non time based chart
ABC type correction scanner
Barindex() is changed with chart zoom. How to fix it
Signals not coming though conditions met!
Eliminate trade entry signals generated in other stocks
Signals not coming though conditions met!
AFL code program
Gap in closing price of previous day and opening price of next in intraday data
How to plot lowest price straddle (call + put) on price chart?
Ranking top value and volume with filter by top 10 Explore / Backtest
Afl money line for amibroker
Profit Factor of strategy to PositionScore of Rotational trading
RSI & Price - Peak and trough
Indicator with lag or referencing past bars, was: Selecting subarray
Hi,ATRa() issue
Displaying Shortcut keys in use
Custom Timeframe H4 doesn't split as expected
StaticVarSet/StaticVarGet Multiple Timeframe Assistance
Please help In color change and added search with many thanks
How to use MACD in AFL coding?
Heikin Ashi of Foreign Ticker
Why CAGR is not appearing on my backtesting results?
Rounding of MA values to tick size
How to plot line only for first 30 mins i.e 9:00 to 9:30 AM
Help with code for Position sizing
Trade when current price > ema
Does anybody else have amiquote only download close data now?
Why my strategy have the same entry and exit in back test ? Please help
Backtesting FOREX, problem with ApplyStop
Decision candle above 2% then no buy
Name() function capable of returning Symbol name from explorer results?
Backtesting problem
How to deal with different system timezone (when next day occurs)
Plotshapes how to use dynamic XShift
Volume Exploration AFL Needed
Volume Exploration AFL Needed
Trail stop loss
Count high to low in CBT
Chart Title Modification
Buy above swing high and sell below swing low?
How to display previous 20,50,100 bars (close)price?
ParamToggle BuyPrice
Save symbols in text format
Displaying time axis correctly?
How to explore the values in given time frame
What are the ways to decrease the scan time in AmiBroker
Help writing accutrack code
Formula error 29
Tying to get Foreign O, C Daily Data in 15 sec TimeFrame
How make a sequence number in the column in explorer
Retest to a big green/red bar?
Arnaud Legoux Moving Average
Arnaud Legoux Moving Average
EMA cross over of price
Candlestick AFL
Modify The CandleWidth of Candle Stick Bar like Candle Volume?
Modify The CandleWidth of Candle Stick Bar like Candle Volume?
How to define a symbol in the code
How to limit no of signal of the complete chart
ibc.closeAll() not working when a ticker is specified
Find High or Low before entry
Current portfolio equity and cash
Time frame label
Backtest uses signals when it should not - How to begin calculation only if required number of bars are available?
Range bar afl code for exploration
Exploration for Current day
StaticVarSet and VarSet
Method of testing of the systems
Implement trailing Stop Loss using ApplyStop
Swing peak and valley value to find between signals
What should one do to backtest 500 scripts in AmiBroker?
How to remove noise from Heikin Ashi further
Overlapping buy and short signals
QuickAFL, was: Problem with BarCount
Accidentally closed main chart with indicators
ORB for previous day
How to Output String variable to Interpretation Window base On Value from array
Calculate ROC rotational
Limiting Calculation of composite to 1 day only
DataBase setting-clarification (minute format)
Distance travelled without intersection
Code conversion from PineScript to Amibroker
How write that correctly
User did not read the manual, was: Autoranking of AFL does not work
The difference between local variables and global variables
How-to-initialize-variable-only-once and Display in Title
StStat and StNorm function
Walk-forward OOS no trades
Impulse MACD [LazyBear] by LazyBear
Line Chart Based on High and Low
Amibroker and ib
Backtest generate no buy signals
AmiQuote 4.12 released
Index Data different on only 1 symbol in Portfolio of stocks
Check your data, was: GICS Import fails
Iterating CSV files to determine ticker and date to download intraday data
Amibroker not backfilling with IB

The Wikipedia has also good article on that subject:

In short:

  1. describe your goal
  2. describe what seems to be the problem
  3. post a minimal, but working code demonstrating the problem

One must not forget about absolute basics like:

  1. including exact VERSION numbers (don't say "latest" - it means nothing)
  2. including minimum, but working reproducible example of the formula that shows the problem that can be copy-pasted and run without modification
  3. better yet, in case of Analysis (backtest/exploration/optimization), save entire PROJECT FILE (File->Save As...) into .APX file and attach it so one can just load the project (this includes formula and settings)
  4. specifying exactly WHAT DATA you are using (or better yet do the test on Yahoo data, so it is reproducible by anyone, not only person having access to some esoteric data).

In short your post must make it EASY and QUICK for anybody to reproduce the issue you are having without ANY effort. Remember it is you who is asking for help. And it is your task to make it easy to help you.


Since some people are afraid of posting their "super secret" formulas...

For what it is worth: when I ask for "full formula" I don't ask for your "secret sauce" or magic Coca-Cola recipe. I don't need to see any holy grail that you invented. What I need is an working example formula (artificial without your "secret sauce") that is enough to reproduce the problem.

The formula that can be copy-pasted without changes and run to reproduce the problem.

It does not need to be profitable, it does not need to include your "magic ingredients". I don't care about that stuff. Remove them. The shorter it is the better. What is needed is shortest possible, working formula to be copy-pasted without changes and run and that it shows the issue in reproducible way.