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

[amibroker] Sell old, buy new, sell new-- all in one day



PureBytes Links

Trading Reference Links

I've tried to work this out and tried to find a solution in the 
archives or the docs.  Although it may be there, I haven't found it 
yet and need some advice.

//This is a short term system which buys on a low RSI
//The following is a quick simplification of the system
  
Buy=ref(RSI(14),-1)< 24;
BuyPrice=open;

//I then have a for loop which has two possible sells:

//first sell
//if same day as "buy day" and there is a low at buyprice =< $.10

sell[i]=true;
sellprice[i]=buyprice[i] - $.10;

//second sell
//if 3 days after "buyday" sell
 
sell[i] = true;
sellprice[i]=open;


Here is the problem.  On a particular stock there may be many buys 
and sells.  Sometimes there will be a sell of a previous trade on 
the same day as a new buy signal. That works OK. However, if the NEW 
trade immediately has another sell signal (ie. when the low goes 
$.10 below the buyprice) there are problems.  

I can see that I have one buy and two sell signals on the same day.  

Thanks, Balin