Hi guys,
Please can someone help with a coding headache?
Would it be possible in v10.3 for an automated strategy to remember the last price entry point for a successful scalping long trade and re-enter once the price has crossed under but then backover? Hope that makes sense.:)
My logic is that on a market sideways day there is money to be made in the small increases before the price fluctuates back down to the baseline.
I’m aware that it can be done with Arrays in v11 but I’m waiting for some of the bugs to be ironed out before migrating over.
Thanks in advance.
Don’t worry, PRT use an array themselves, it’s TRADEPRICE(n).
IF (n) is omitted or is equal to 1, then it refers to the most recent price (bear in mind that it can be either an entry or an exit price).
If you are OnMarket then TRADEPRICE(1) is the last entry price and TRADEPRICE(2) is the previous trade’s exit price, etc….
If you are NOT OnMarket then TRADEPRICE(1) is the last trade’s exit price and TRADEPRICE(2) is the last trade’s entry price, etc…
Things get complicated when you accumulate positions, since any trading price will increase that array, so you will have to keep track of them in a different way.
Thanks as always Roberto that’s perfect. I’ll add it in and run some tests now.