Australian (ASX) Stock Market Forum

Amibroker FAQ

Hello,
why varset is not assigning value right way or Is there any other issue?
when i do manually assign m2, it does work
m2 represent 2 number under candle hence I can plot _m line
When i try to do same stuff with loop, I get error m2 not initiated
but I've initiated it with varset as below


VarSet( "M" + i, TimeFrameExpand( up, i*in1Minute , expandPoint ) );
// Isn't M2 = TimeFrameExpand( up, 2*in1Minute , expandPoint ); ?



BELOW CODE IS WORKING FINE
Code:
Code:
Plot( C, ""+Interval(2), styleCandle );
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
dt = DateTime();
SetBarsRequired( -2, -2 );
expandmode=expandPoint;

    TimeframeSet( in1Minute );   //  TimeframeSet(i * in1Minute);    
    up = C > O;
    M1 = TimeFrameExpand( up, in1Minute , expandPoint ); 
    TimeframeRestore();
 
    TimeframeSet( 2*in1Minute );
     up = C > O; 
    M2 = TimeFrameExpand( up, 2*in1Minute , expandPoint );
    TimeframeRestore();
     
     dist = 0.1*ATR(1);
    for( b = 0; b < BarCount; b++ )
{
//------  yellow is the Invertedhammer  with NO space
if( m1[b] ) PlotText( "1" , b, L[ b ]-1-dist[1], colorRed );  
if( m2[b] ) PlotText( "2" , b, L[ b ]-1.4-dist[1], colorRed );
if( b > 11 )
[COLOR="#FF0000"]if (m2[b])
PlotText( "_m" , b, L[ b ]-1-dist[1], colorgold );
}[/COLOR]

EO2LBpS.png

BELOW CODE IS NOT WORKING FINE , SAME UPPER STUFF TRIED WITH LOOP

Code:
Plot( C, ""+Interval(2), styleCandle );

for( i = 1; i < 3; i++ )
{

    TimeframeSet( i*in1Minute );
    up = C > O;
    TimeframeRestore();
    
[B][COLOR="#FF0000"][SIZE=4]VarSet( "M" + i, TimeFrameExpand( up, i*in1Minute , expandPoint ) );
// Isn't M2  =  TimeFrameExpand( up, 2*in1Minute , expandPoint ); ?[/SIZE][/COLOR][/B]
M = VarGet( "M" + i );

   for( b = 0; b < BarCount; b++ )
    {
if(M[b] )   PlotText(" "+(i), b, L[b]-1-(i), colorRed);

[COLOR="#FF0000"]if (M2[b])
{
PlotText( "" , b, y[ b ], colorRed );
}

[/COLOR]
}
}
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );

6ybYHT7.png

Why is this happening?
 
Hi. I have a question about using Amibroker intraday. I am having problems aligning the different opening market phases with the price bars in Amibroker. Can someone please share their settings for intraday? Thanks
 
Hi all

Having a problem with some Ami code I cant seem to fix.

I am working on a simple system of buying the 250 day high and selling the 250 day low. My entry filters are Liquidity average being over 500,000 for the last 7 days and Turnover being higher than $500,000 for the last 7 days.

My problem is I would like to add the Turnover and Liquidity averages to the back test results. In the following cod I have managed to get the columns into the back test results but they have no data in them.

Any help would be much appreciated.

Thanks

SetTradeDelays( 1, 1, 0, 0 );
SetOption( "Initialequity", 100000 );
SetOption( "MaxOpenPositions", 20 );
SetPositionSize( 5, spsPercentOfEquity );

NewYearlyHigh = HHV( C, 250 );
Plot( NewYearlyHigh, "NewYearlyHigh", colorGreen, styleLine );
NewYearlyLow = LLV( C, 250 );
Plot( NewYearlyLow, "New Yearly Low", colorRed, styleLine );

Liquidity = EMA( V, 7 );
LiquidityOk = Liquidity >= 500000;

Turnover = EMA( C*V, 7 );
TurnoverOK = Turnover >= 500000;

SetCustomBacktestProc( "" );

if( Status( "action" ) == actionPortfolio )
{
bo = GetBacktesterObject();

bo.Backtest(); // run default backtest procedure
NumTrades = 0;

// iterate through closed trades first
for( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade() )
{
trade.AddCustomMetric( "Liquidity", Liquidity );
trade.AddCustomMetric( "Turnover", Turnover );
NumTrades++;
}

bo.AddCustomMetric( "Liquidity", Liquidity );
bo.ListTrades();
}

Buy = C >= NewYearlyHigh AND( MarketID( 0 ) == 0 OR MarketID( 0 ) == 1 ) AND LiquidityOk AND TurnoverOk;
Sell = C <= NewYearlyLow;

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

P.S I am requiring the data for liquidity and turnover for two reasons. 1 I want to know the filter is working correctly and 2 I would like to know how to do it for future reference.

In order to pass variables from first phase to 2nd phase (custom backtest interface) you have to you static variables.
 
A heads up for anyone who may have used Quotetracker with Amibroker in the past. A plugin for Medved Trader is now available for 32-bit Amibroker.

Medved Trader:

https://www.medvedtrader.com/www/frontend

Broker/Data sources. (IB, Bell Direct, Commsec and ETrade in Australia)

https://www.medvedtrader.com/www/frontend/datasource

Amibroker Plugin:

http://www.amibroker.com/devlog/2016/09/13/medved-trader-data-plugin/

I don't use it personally so can't provide any assistance but there's been quite a few threads/questions regarding Quotetracker alternatives and ASX data plugins for Amibroker so thought I'd post this here for anyone who may have missed the announcement.
 
My ASX data seems to have been wiped after doing an 'indicator maintenance', but my last backup was almost a year ago.

When I go into C:\Program Files\AmiBroker\ASX\B\BHP

I can see the data for BHP is 155KB. Is this about the size of an EOD file for one stock going back 15 or so years? If it is, how do I go about getting the data showing again?

Thanks.
 
A heads up for anyone who may have used Quotetracker with Amibroker in the past. A plugin for Medved Trader is now available for 32-bit Amibroker.

Medved Trader:

https://www.medvedtrader.com/www/frontend

Broker/Data sources. (IB, Bell Direct, Commsec and ETrade in Australia)

https://www.medvedtrader.com/www/frontend/datasource

Amibroker Plugin:

http://www.amibroker.com/devlog/2016/09/13/medved-trader-data-plugin/

I don't use it personally so can't provide any assistance but there's been quite a few threads/questions regarding Quotetracker alternatives and ASX data plugins for Amibroker so thought I'd post this here for anyone who may have missed the announcement.

NOTE: To enable the API in Medved Trader, start the program, then go to:
FILE / SETTINGS / APPLICATION / API

and check the box to enable the API
 
NOTE: To enable the API in Medved Trader, start the program, then go to:
FILE / SETTINGS / APPLICATION / API

and check the box to enable the API

Thanks Jerry. Great to see your new application up and running. I used Quotetracker for a while early on. Not using Medved Trader myself but it's a great looking platform, well done :xyxthumbs
 
My ASX data seems to have been wiped after doing an 'indicator maintenance', but my last backup was almost a year ago.

When I go into C:\Program Files\AmiBroker\ASX\B\BHP

I can see the data for BHP is 155KB. Is this about the size of an EOD file for one stock going back 15 or so years? If it is, how do I go about getting the data showing again?

Thanks.


My BHP file is 58 kB for 6 years. Your data is not lost. Just to prove it you could copy the broker.master file from your old backup to the Data folder. Make sure you back up the current one somewhere.
 
My BHP file is 58 kB for 6 years. Your data is not lost. Just to prove it you could copy the broker.master file from your old backup to the Data folder. Make sure you back up the current one somewhere.

Great thanks for that. What about getting the whole thing back working? Any ideas/?
 
Great thanks for that. What about getting the whole thing back working? Any ideas/?

The first thing to do is look at the Database path in Preferences|Data. I can't imagine why this would have changed while doing an indicator maintenance, though.
Are you getting a blank chart up with a message saying "not enough data?" Or is there no chart window?

TBH, I'm not such an expert and have encountered this kind of problem occasionally. Sometimes I just gave up and restored a backup.
This is classic troubleshooting and more details will be needed to solve it. Like what does it look like? What's missing, etc.
I'm happy to help to the best of my ability.
 
The first thing to do is look at the Database path in Preferences|Data. I can't imagine why this would have changed while doing an indicator maintenance, though.
Are you getting a blank chart up with a message saying "not enough data?" Or is there no chart window?

TBH, I'm not such an expert and have encountered this kind of problem occasionally. Sometimes I just gave up and restored a backup.
This is classic troubleshooting and more details will be needed to solve it. Like what does it look like? What's missing, etc.
I'm happy to help to the best of my ability.

About 99% of symbols have no data at all. The remaining 1% have full history and will plot ok, so it's not a window pane issue. Symbol>quote editor also shows no data for the 99% of symbols.

I feel like I should be able to copy-paste the following files somewhere so that AB can start reading them again.

x.png
 
OK, my database looks about the same, those tickers should all display something. Do you have charts with those tickers?
If 99% display no charts, that would mean corrupted data.
 
OK, my database looks about the same, those tickers should all display something. Do you have charts with those tickers?
If 99% display no charts, that would mean corrupted data.

Nope, no charts for those symbols shown. How could data get corrupted with an indicator maintenance?
 
Nope, no charts for those symbols shown. How could data get corrupted with an indicator maintenance?

Good question. Let me think about it. So you're saying that BHP shows no chart even though the file is 155 kB?

If so, can you attach or PM me the BHP file (or any of the others that don't display, doesn't matter).
 
Good question. Let me think about it. So you're saying that BHP shows no chart even though the file is 155 kB?

If so, can you attach or PM me the BHP file (or any of the others that don't display, doesn't matter).

I was also fiddling around with the Medved .dll and maybe that caused instability. Forgot about that.

And then I got confused about the 32 bit versus 64 bit thinking that the 64 bit was in Program files(x86) which is not the case. Hell...

I seem to have got the data back for the moment but a lot of panes are now missing.

Thanks for the help Haba - hopefully I'll be ok from here. :)
 
My ASX data seems to have been wiped after doing an 'indicator maintenance', but my last backup was almost a year ago.

When I go into C:\Program Files\AmiBroker\ASX\B\BHP

I can see the data for BHP is 155KB. Is this about the size of an EOD file for one stock going back 15 or so years? If it is, how do I go about getting the data showing again?

Thanks.

All you need to do is:

1. Closing AmiBroker
2. Deleting Broker.Master
3. Restarting AmiBroker

It will re-build the database from stock files. First start of AB will be a little bit slower becasue of rebuilding process.

As for 64-bit vs. 32.bit plugins.
64-bit plugins don't belong to 32-bit plugins folder of Program Files (x86) because that's the directory of AB 32-bit.
Also 32-bit plugins don't work in 64-bit AB.

32-bit to 32-bit and 64-bit to 64-bit. Apples to apples and oranges to oranges.
 
Top