There is a function Highest!
Code://Buy when new all-time high close is made Buy = C > Ref(Highest(C), -1);
Well, that certainly looks a lot more elegant and I would assume cuts down on computation. Thank you for the suggestion.
There is a function Highest!
Code://Buy when new all-time high close is made Buy = C > Ref(Highest(C), -1);
Hi.
Can somebody here please help ?
I am trying to reference the current bar as having it's close within the range of the highest volume bar of the last 10 days.
The best I can come up with is this but doesn't work?
C<HHV(V,10) AND C>LLV(V,10);
Thanks
Try something like this:
X = BarsSince(V==HHV(V,10));
C<Ref(H,-X) AND C>Ref(L,-X);
Try something like this:
X = BarsSince(V==HHV(V,10));
C<Ref(H,-X) AND C>Ref(L,-X);
Hi again. It works. Thanks for that. Could you or anybody help with how to label that HHV bar so that I can define it's characteristics eg up bar or wide range bar etc.
Thanks
When you run a back-test in AA, the MAE & MFE columns are visible and shows the favourable % excursion from buy (or short) price and adverse % excursion from buy (or short) price for each trade. In the AA back-test report there is a chart representation of the MAE & MFE.Hi Gents,
How do I get an exploration to show MFE and MAE plz ?
Cheers!
Hi Gents,
How do I get an exploration to show MFE and MAE plz ?
Cheers!
// http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/
// Modified to use HHV
StopLevel = 1 - Param( "trailing stop %", 3, 0.1, 10, 0.1 ) / 100;
HHVperiod = 10;
Buy = Cross( MACD(), Signal() );
Sell = 0;
LongtrailARRAY = Null;
Longtrailstop = 0;
myhigh = HHV( H, HHVperiod );
for( i = 1; i < BarCount; i++ ) {
if( Longtrailstop == 0 AND Buy[ i ] ) {
Longtrailstop = myhigh[ i ] * stoplevel;
}
else Buy[ i ] = 0; // remove excess buy signals
if( Longtrailstop > 0 AND Low[ i ] < Longtrailstop ) {
Sell[ i ] = 1;
SellPrice[ i ] = Longtrailstop;
Longtrailstop = 0;
}
if( Longtrailstop > 0 ) {
Longtrailstop = Max( myhigh[ i ] * stoplevel, Longtrailstop );
LongtrailARRAY[ i ] = Longtrailstop;
}
}
PlotShapes( Buy*shapeUpArrow, colorGreen, 0, Low );
PlotShapes( Sell*shapeDownArrow, colorRed, 0, High );
Plot( Close, "Price", colorGrey40, styleBar );
Plot( LongtrailARRAY, "trailing stop level", colorRed );
SetForeign( "XAO" );
FastMALength = Optimize("FMA",50,30,70,2);
SlowMALength = Optimize("SMA",200,180,200,2);
Filter1 = EMA( C, FastMALength ) > EMA( C, SlowMALength );
RestorePriceArrays();
//This is the additional filter I have introduced to try and filter out low volume stocks
VolA = Volume * C;
MAVol = MA( VolA, 15 );
Filter = Filter1 AND MAVol > 350000;
I currently have the following filters in place, following help from the good folk here:
Code:SetForeign( "XAO" ); FastMALength = Optimize("FMA",50,30,70,2); SlowMALength = Optimize("SMA",200,180,200,2); Filter1 = EMA( C, FastMALength ) > EMA( C, SlowMALength ); RestorePriceArrays(); //This is the additional filter I have introduced to try and filter out low volume stocks VolA = Volume * C; MAVol = MA( VolA, 15 ); Filter = Filter1 AND MAVol > 350000;
I would like to place a further filter in to filter out individual stocks whose fast EMA is less than their slow EMA. I would appreciate help on how to add a third filter to the above.
Filter2 = EMA(C,60) > EMA(C,180);
Filter = Filter1 AND Filter2 AND MAVol > 350000;
Hi All,
Sorry for the newbie question. I want to build an array from a list of numbers(.txt file). The list contains the "BarIndex" number for where trade signals occurred. The list is less than 50 items(comma separated), while the array should be of current database length(approx. 10K).
I created the list for another purpose, but wanted to be able to utilize the data in other ways. Simply, I want to learn how to build the array from said list----never done that before (always working in "afl"). Please note that I'll be working from a database that will not be updated.
TIA,
RutheezKey
QUESTION
I have been backtesting my Trading strategy and achieving pleasing results before I read a post by Howard Bandy answering a members question - the member wanted to know the formula to execute a BUY the next day after the signals is generated - meaning the BUY is execute at the next day's opening price.
As that's how I plan to trade I added Howard Bandy's code to my strategy.
Once I added the code to my strategy my Backtest results went from a yearly Net Profit of $26,044 to a yearly Net Loss of -$3,534
I wouldn't have thought buying the next day compared to buying the same day the signal is generated would make such a difference to my Backtest results.
Can anyone shed light on how this could be possible?
The Code I added
/////////////////////////////////////////////////
BuyPrice = Open;
SellPrice = Open;
SetTradeDelays(1,1,1,1);
/////////////////////////////////////////////////
skate.
Thanks Trash!
Nice to see TJ posting to the KB these days (almost forgot about them). I did a Google-search but missed the item you provided.
Do you use the Osaka plugin? If so, any warnings before I go there. Having arrays of strings would be nice.
In most cases you wont know if the buy signal has been generated until the end of the day, depending on what your buy conditions are. Therefore your code to buy on the same day as the signal is generated is looking into the future.
Hello and welcome to Aussie Stock Forums!
To gain full access you must register. Registration is free and takes only a few seconds to complete.
Already a member? Log in here.