- Joined
- 13 January 2013
- Posts
- 258
- Reactions
- 50
_SECTION_BEGIN( "ArrayHL" );
function ArrayHL( Periods )
{
customArray = 0;
j = BarCount - 1;
for ( i = BarCount - 1; i >= 0; i-- )
{
if ( j < 2 * Periods )
break;
for ( count = 0; count <= Periods; count++ )
{
customArray[ j ] = H[ i - count ];
j--;
customArray[ j ] = L[ i - count ];
j--;
}
}
return CustomArray;
}
_SECTION_END();
_SECTION_BEGIN( "PercentileHL" );
Periods = Param( "Periods", 3, 1, 20, 1 );
Percent = Param( "Percentile (%)", 50, 0, 100, 5 );
Array = ArrayHL( Periods );
PA = Percentile( Array, 2 * Periods, Percent );
Plot( PA, "PercentileHL", colorRed, styleLine );
_SECTION_END();
Hi everybody,
Just a quick newbie question here : When I click on the show arrows for actual trades option in the analysis window after a backtest, I notice that the arrows disappear after approximately 70 seconds if I don't move the chart. This is annoying as I then have to go back to the analysis window and select the arrows option again. Is there a way to keep the arrows there other than moving the chart before the 70 seconds are up?
Dear All,
I am new in here and learning to use Amibroker, I have a question which I actually don't know how to solve it.
I have a breakout strategy with the trailing stop. However, I discovered that the logic is unrealistic as I set the stop when H < UpperBand and L < trailing stop. The problem is that L could come first which hit my stop first in real time trading. If L hit my stop point first and H hit the upperband later, then the position will be cleared first and entered again. But I will still hold the position in backtest if H also hit the upperband at the same bar but no exit generated at this bar. It will create an unreasonable profit.
I would like to correct my strategy now. So, I would like to ask is there any method to prohibt my entry signal for the bar where exit is generated. I know there is an option for same bar entry/exit. However, i would like to write it in my AFL which can be used in live trading.
Thank you very much!!
// sample system start
period = 20; // number of averaging periods
m = MA( Close, period ); // simple moving average
Buycond = Cross( Close, m ); // buy when close crosses ABOVE moving average
Sellcond = Cross( m, Close ); // sell when closes crosses BELOW moving average
// sample system end
SellCounter = Cum( Sellcond );
SellSinceBuy = SellCounter - ValueWhen( Buycond, SellCounter );
Sellcond2 = SellSinceBuy == 1; // 1st sell signal since buy
Buy = Buycond AND BarsSince( Sellcond2 ) >= 1;
Sell = Sellcond;
Try this one
Code:// sample system start period = 20; // number of averaging periods m = MA( Close, period ); // simple moving average Buycond = Cross( Close, m ); // buy when close crosses ABOVE moving average Sellcond = Cross( m, Close ); // sell when closes crosses BELOW moving average // sample system end SellCounter = Cum( Sellcond ); SellSinceBuy = SellCounter - ValueWhen( Buycond, SellCounter ); Sellcond2 = SellSinceBuy == 1; // 1st sell signal since buy Buy = Buycond AND BarsSince( Sellcond2 ) >= 1; Sell = Sellcond;
Try this one
Code:// sample system start period = 20; // number of averaging periods m = MA( Close, period ); // simple moving average Buycond = Cross( Close, m ); // buy when close crosses ABOVE moving average Sellcond = Cross( m, Close ); // sell when closes crosses BELOW moving average // sample system end SellCounter = Cum( Sellcond ); SellSinceBuy = SellCounter - ValueWhen( Buycond, SellCounter ); Sellcond2 = SellSinceBuy == 1; // 1st sell signal since buy Buy = Buycond AND BarsSince( Sellcond2 ) >= 1; Sell = Sellcond;
Hello,
May I ask one more question how to plot the actual trades as what backtester show?
Currently i am using the following code for plotting but it will plot every signal in my strategy. As I remvoed some signal generated at the same bar, some long/short signals actually were not the actual one.
PlotShapes(Buy*shapeUpArrow,colorGreen,0,Low);
PlotShapes(Sell*shapeDownArrow,colorRed,0,High);
PlotShapes(Short*shapeDownarrow,colorblue,0,High);
PlotShapes(Cover*shapeUparrow,colorbrown,0,Low);
Thank you for your help.
To remove excessive signals in chart use ExRem for example.
I don't understand your last sentence. Anyway I'm not a magician or psychic that can read your brain. Either offer more info, code or picture or otherwise you're on your own. It's no fun playing wheel of fortune.
Sorry. i think i know what is the problem in my code after thinking for night. Thank you for your help.
And what is/was the problem? Perhaps others face or will face same/similar problem. So why not posting what you have found out so that others may refer to it?
I notice you haven't posted for awhile but did you find a way to manipulate VAP? I have tried price and volume to manipulate bar colour to reflect bullish or bearish but these values are wrong arguments. Something like this doesn't work.Hi Guys, Can I get some help with volume-at-price please?
I'm interested in looking at making the highest volume price from the previous period (say a month) the trigger price.
_SECTION_BEGIN("VAP");
segments = IIf( Interval() < inDaily, Day(), Month() );
segments = segments != Ref( segments , -1 );
N = Optimize( "N", 3, 1, 7, 1 );
HoldDays = Optimize( "HoldDays", 7, 1, 7, 1 );
ProfitTarget = Optimize( "ProfitTarget", 4, 2, 40, 2 ) / 10;
N = Optimize( "N", 3, 1, 7, 1 );
HoldDays = Optimize( "HoldDays", 7, 1, 7, 1 );
step = 0.2;
ProfitTarget = Optimize( "ProfitTarget", 0.4, 0.2, 4 + step/2, step );
I've been using Amibroker for a couple of weeks now and am reading all I can about trading systems.
I'd like to trade the Australian market and the S&P500. I'm a while off making any 'real' trades and am testing out different systems and ideas at the moment.
I initially set up Amibroker with a downloaded list of ASX stock tickers, but have quickly realised that this list hasn't been updated for a while so there are stocks missing, others that have ceased trading etc. Obviously this affects the accuracy of my back-testing.
What data sources do you use to set up the initial database - I'm assuming I'd need historical data that's adjusted for splits etc. I'm happy to pay for this data.
On an ongoing basis, what are the data providers that people use. If I download the EOD data from Yahoo I'm assuming that'll work for a while, but I'd need to manually update splits etc. An alternative is to subscribe to EOD data that has all the updates as part of the package.
I'm looking for value for money when it comes to this data. What do you all recommend?
I've been using Amibroker for a couple of weeks now and am reading all I can about trading systems.
What data sources do you use to set up the initial database - I'm assuming I'd need historical data that's adjusted for splits etc. I'm happy to pay for this data.
On an ongoing basis, what are the data providers that people use. If I download the EOD data from Yahoo I'm assuming that'll work for a while, but I'd need to manually update splits etc. An alternative is to subscribe to EOD data that has all the updates as part of the package.
I'm looking for value for money when it comes to this data. What do you all recommend?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?