Hi Tikitaka, great job, thank you very much. I got already more than i thought. However have seen things to tweak if you feel like:
a) Sometimes there is a low<low[1] but the stop is not risen. It is because in the same candle we got a high>high[1]. Examples Citigroup (feb1993), Sabadell (may2016), ENGI(jan2008), ESRX (may2015).
b) Sometimes systems stops, i don´t know why, maybe is database, my computer, tell me if happens to you. Examples: British American Tobacco (from 2010 doesn´t give signals and we have new maximums), Next (NTX)(from 2011), Royal Dutch Shell(from 2012), Sabmiller (SAB from 2012).
c) System buys when prices is >= historical maximun and it should be >. In fact i normally put a filter of some cents. Example: Standard Chartered(STAN) (nov 2010).
I don´t know if i am going too far but taking advantage of your kindness i would ask you if you can:
1.-Code it for short positions. Same logic but for going short.
2.-What do i have to add and where, if i want to raise the stop to the entryprice+1% when prices reach 10% of profit. Something like:
if longonmarket and high>=tradeprice*1,1 then
sell at tradeprice*1.01
else sell at exitprice stop
3.-Change 2000 cash into shares following this formula: Number of shares will be (Equity line*0,6%)/(Entryprice-Stopprice) and if the result multipied by the price of the stock is less than 1000 don´t buy. Equityline is 50.000 when we start and later what i have in the equity line or equity curve (the result of add to 50.000 previous trades).
I imagine you running away after this post and i understand. The thing is that i don´t know if what i am asking you is difficult or not. If it is going to take you long forget it please, you have already did enough.
In fact you can forget a), b) and c) if it takes you time and pay attention to what is more important to me: 1) then 2) and finally 3). (I believe point 3 is the most difficult one and is the less important to me).
already gratefull, cheers