the entryprice is the latest buyprice of the raw signal and what I would like is to recall the buyprice of the trade (open position)
agreed, I've also posted this problem to the amibroker yahoo group and will keep you posted when I discover a good answer.
It is a pity, everything else I've tried works great and fast but somehow recording the first buy signal is not easy...
No, I never found a solution. Should contact Amibroker support about it.
Hi AlterEgo --
There are several ways to treat multiple signals. I did not address any of the options in my earlier posting.
-------------
Another is to use looping code to handle the conditions exactly as you wish.Thanks,
Howard
You'd think there should be a built in AFL function to do it though, rather than having to use looping. Looping is a bit beyond my level of Amibroker ability at this moment in time.
I've just spent about 6 hours trying 50 or 60 variations of some looping code that Amibroker support sent me yesterday. Unfortunately, when you don't know what you're doing, trial and error like this becomes very frustrating.
OK, I just realised that what I wrote above will not work if my sell condition references the BuyPrice because Amibroker will have to update BuyPrice every time there is a new buy signal (even if there hasn't been a 'sell' yet).
This is because I can't tell Amibroker to "ignore new buy signals until there is a sell signal", because that requires ExRem(Buy,Sell), which requires defining "Sell".
And I can't define "Sell" until I know what my BuyPrice was, because I only want to sell if I am greater than BuyPrice.
So I'm back to not knowing the answer, and would really appreciate your help again.
Anybody? Howard? Please?
Dear all,
I've been backtesting with amibroker for the past few days and I just hit a wall in my simple coding.
I am using 15 days of intraday data (15min).
Buy = Cross(RSI(C,6),15);
Sell = Cross(85,RSI(C,6) AND Ref(Close,-1)>BuyPrice*1.01;
1. One of my two sell condition is to have the exit price > entry price*1.01. In my results some exit prices are still below the entry prices and I've no idea why For example it bought at 5.03 and sold at 4.25!
I am starting to guess that the BuyPrice is not the entry price of my actual trade (5.03)
2. It is possible to test 5min intraday? In the settings periodicity I see only 15min and 20 min?
Any help will be greatly appreciated,
Cheers,
Chris
Buy = Cross( RSIa( C, 6 ), 15 );
Sellcond = Cross( 85, RSIa( C, 6 ) );
Sell = IIF( Ref( Close, -1 ) > BuyPrice * 1.01, Sellcond, 0 );
Regarding the problem with Buystop I have found a way to fix it. I need
to place the Buyprice sentence:
BuyPrice=ValueWhen(Buy,Max(O,Ref(Entrypt,-1)));
below the Exrem() sentence, thus I remove the other ocurrences of Buy
that move the Buyprice. Try it and you will see that the Buyprice is now
a constant while long (the blue line). I guess this is a typical error
when coding since we always want Buyprice below Buy signal. Buyprice
needs to be static.
Thanks for posting that, goog64.
For some reason the backtester does not detect when the stock close is above the EMA of the XAO 15.
No worries.
Thanks for the clean up superboot. (My Buy signals are outside the looping section, so I missed that.)
Superboot, regarding your alternative method: I can't see how it works if all one's signals require a reference to BuyPrice? How do you discard the sell signals generated by this line:
Sell = Sell conditions (excluding any that reference BuyPrice)?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?