I am going to start with (I'm new here go easy on me)...
My intention here is to ask the forum community to sanity check that what I am trying to achieve is in fact possible in AmiBroker.
Long only Position strategy that I am trying to create.
Maximum Positions Open: 10
Maximum Positions in 1 single Market: 4
An initial Trend following signal is triggered:
Long_period = 55 ;
Long_HH = Ref( HHV( High, Long_period ), -1 ) ;
ChannelBreakUp = Close > Ref( HHV( High, Long_period ), -1 );
This will then trigger an initial Buy based on Core Equity 1% risk amount based on an ATR Stop-Loss.
TrailStopAmount = 2 * ATR( 20 );
Capital = 100000; /* IMPORTANT: Set it also in the Settings: Initial Equity */
Risk = 0.01*Capital;
PositionSize = (Risk/TrailStopAmount)*BuyPrice;
Intention to Open the position the following day after the Buy Signal is triggered:
SetTradeDelays( 1, 1, 0, 0 );
On opening the initial position I want to set 3 BuySignals for 3 Pyramid position entries:
//ATR
ATR_period = 15 ;
ATR_multiplier = 2 ;
ATR_val = ATR(ATR_period) ;
ATR_SL = (ATR(ATR_period)*ATR_multiplier) ;
ATR_stop = Long_HH-ATR_SL ;
// Pyramid
Pyramid_pos1 = Long_HH+ATR_val ;
Pyramid_pos2 = Long_HH+(2*ATR_val) ;
Pyramid_pos3 = Long_HH+(3*ATR_val) ;
I also want to set a Position Count variable to 1 when the first position is entered:
Position_Count = 1 ;
BarCount = 0
If the position count is 1 the I want to check for the Pyramid position BuySignal.
C > Pyramid_pos1
Each cycle of the IF statement I will increment the BarCount
for ( i = 0; i < BarCount ; i++ )
{
if ( Position_Count == 1 AND Pyramid_pos1 [ i ] )
{
}
above from: https://www.amibroker.com/guide/h_pyramid.html
If the conditions are met then I wish to Buy the 1st Pyramid Position and Set another ATR based Stop loss.
Question that I for the forum community, is it possible to set and alter the stop-loss points for each position. I have been reading around the scale-in and scale-out options though this does not look possible to support the custom position Stop Loss values and custom Buy conditions (checking BarCount and PositionCount)
Any suggestions or feedback will be appreciated.
Thank you