PureBytes Links
Trading Reference Links
|
Hi Yuki,
A.
BUY=(B > REF(B, -1) AND
SELL=(B
You do not need the ( after =
B.
>I want to buy or sell the next day,
>and only then if ...
Let
buy=cross(stochd(),30);
graph0=buy;
This will give an 1, when Condition is true.
The
graph1=ref(buy,-1);
will give 1 the next day.
So, you may create a temporary buy, called buyt.
buyt=cross(stochd(),30);
buy=ref(buyt,-1) and ... and ...;
C.
>Later, I will look for filters or indications that
>might suggest when to let the winning trades run a bit.
This will be trully great.
D.
>Rather easy to code in MS, but I haven't figured out how to do it in
>AB yet.
"Yet" will be the only correct word in a couple of weeks.
Keep up good work !!
Dimitris Tsokakis
--- In amibroker@xxxx, Yuki Taga <yukitaga@xxxx> wrote:
> Hi Dimitris,
>
> I got this code that you wrote below to run a back test. However, I
> cannot find how to put the buy and sell arrows on the chart that
your
> gif shows.
>
> DT> /*Example*/
> DT> Slw = 3;
> DT> Pds = 10;
> DT> A = Ema((Close -LLV(Low,Pds))/(HHV(H,Pds)-LLV(L,Pds)),Slw)*100;
> DT> B=Ema((A-LLV(A,pds))/(HHV(A,Pds)-LLV(A,Pds)),Slw)*100;
> DT> Graph0 = B;
> DT> BUY=CROSS(B,30);
> DT> SELL=CROSS(70,B);
> DT> BUY=EXREM(BUY,SELL);
> DT> SELL=EXREM(SELL,BUY);
>
> I've also modified the code, which I see from later messages that
you
> have done also. My intention to test, which I have not figured out
> completely how to do in AB yet, is to sell on a change in direction
> down but above 70, and buy on a change of direction up, but below
30.
> All changes in direction between 30 and 70 are ignored.
>
> So, I'm starting with:
>
> Slw = 3;
> Pds = 10;
> A = Ema((Close -LLV(Low,Pds))/(HHV(H,Pds)-LLV(L,Pds)),Slw)*100;
> B=Ema((A-LLV(A,pds))/(HHV(A,Pds)-LLV(A,Pds)),Slw)*100;
> Graph0 = B;
> BUY=(B > REF(B, -1) AND REF(B, -1) < REF(B, -2)) AND B < 30;
> SELL=(B < REF(B, -1) AND REF(B, -1) > REF(B, -2)) AND B > 70;
> SHORT=SELL;
> COVER=BUY;
> BUY=EXREM(BUY,SELL);
> SELL=EXREM(SELL,BUY);
>
> There is one additional filter, however, and this is what I haven't
> coded yet, because I haven't learned how:
>
> I don't want to buy or sell on the signal date, although as you have
> noted this produces a mildly profitable system. I want to buy or
> sell the next day, and only then if the previous day's H (for a buy)
> or L (for a sell) is exceeded. The buy and sell stops would be
> either ref(H,-1) +1 or ref(L,-1) -1. Since we trade by yen in
Japan,
> and it is not divisible, this should work, even though some stocks
> trade in increments of more than one yen, while others trade in
> one-yen increments. I suspect I would have to change the formula
for
> stocks that trade in greater than one yen increments, however, to
get
> a true stop price for back testing. If H or L is not exceeded, the
> signal is ignored. This is the actual test that I would like to
run.
> Rather easy to code in MS, but I haven't figured out how to do it in
> AB yet.
>
> Also, as you noted in a later message, this is indeed a 'take the
> money and run' indicator. It needs a tight stop loss, and a tight
> profit target. Later, I will look for filters or indications that
> might suggest when to let the winning trades run a bit. As is,
> however, I don't think this system would get anyone killed, provided
> they use proper stop loss (money management) tactics.
>
> Thanks for your help on this.
>
> Yuki ^_^
|