[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Need some assistance with this system



PureBytes Links

Trading Reference Links

Hi

I am trying to create a system that will allow me to trade 5 stocks per day
with a specific criteria.  The problem is that I get stuck after the Entry
price which cancels the other one.  Any help is appreciated.

thanks

qitrader

Conditions:

1st Trade

Entry Trigger: If price crosses either entry1 (from below, long) or entry2
(from above, short), then the other is cancelled and we begin with the
following:

Profit Objective

If Longs, then Entry Price + Profit Target Number = Sell Limit Order

If Shorts, then Entry Price - Profit Target Number = Buy to Cover Limit

2nd Trade or stop risk

Reversal trade

If Long, then Highest Price during Trade - Risk Number = Sell Stop (round
down to next lower 1/8th)

If Short, then Lowest Price during Trade + Risk Number = Buy Stop to Cover
(round up to next higher 1/8th)

Calculate the profit the same way I did in 1st trade.

Only 2 trades per stock.  1st is usually the entry trigger and  2nd is the
reversal stop

Here is my code:

///////////////////////////////////////////////////////////////////////////////

TradeOpenNumber  = Param("1st Trade Open Number",0,0,1,.01);
ProfitTargetNumber  = Param("Profit Target Number",0,0,2,.01);
RiskNumber  = Param("Risk Number",0,0,2,.01);

TodayOpen = TimeFrameGetPrice( "O", inDaily, 0 );

entry1 = todayOpen + TradeOpenNumber ;

entry2 = todayOpen - TradeOpenNumber ;

Sell1 = entry1 + ProfitTargetNumber;

Cover1 = entry2 - ProfitTargetNumber;

reverse_short = H - RiskNumber ; //round to lower of 0, .87, .75, .62, .5,
.37, .25, .12, 0

reverse_long = L + RiskNumber ; //round to higher of 0, .87, .75, .62, .5,
.37, .25, .12, 0

Filter = Cross (C, entry1) OR Cross (entry2, C) ;

AddColumn (TodayOpen, "Open", 1.2) ;
AddColumn (entry1, "Long", 1.2) ;
AddColumn (entry2, "short", 1.2) ;
AddColumn (Sell1, "Profit Target 1", 1.2) ;
AddColumn (Cover1, "Profit Target 2", 1.2 ) ;