PureBytes Links
Trading Reference Links
|
Thanks Terry
I replaced the scrip with this as you suggested
PP = Ref(Avg,-1);
R1=(PP * 2) - Ref(Low,-1);
S1= (PP * 2) - Ref(High,-1);
Buy = S1 > Low;
BuyPrice = S1;
Sell = R1 < High;
SellPrice = R1;
It stills buys the low or the S1 value. If the S1 value does not
exist it will buy the low.
So I still need some help.
Thanks Ernie
--- In amibroker@xxxxxxxxxxxxxxx, Terry <MagicTH@xxxx> wrote:
> You are mixing loop code with array code. That won't work. You have
to
> use one or the other.
> For example, replace this:
>
> if (S1[0] < Low[0]) //This only tests the first bar, everytime
for every bar so no signals.
> Buy = 0;
> else if (S1[0] > Low[0]) //Same here
> Buy = S1;
>
> With this:
>
> Buy = S1 > Low; //This sets all bars at once
>
> Same idea for Sell.
>
> Terry
>
> Ernie Newman wrote:
>
> > I am trying to write a backtest to BUY at the Support level S1
and
> >sell when the Resistance level R1 is reached. The codes I have
been
> >trying will not BUY at the S1 or Sell at R1. How can I get AB to
only
> >buy at S1 when the price has actually traded in that range. I
would put
> >in an order to buy that price if touched and sell at R1 if
touched. I
> >just can't seem to be able to backtest this.
> >
> >
> >PP = Ref(Avg,-1);
> >R1=(PP * 2) - Ref(Low,-1);
> >S1= (PP * 2) - Ref(High,-1);
> >
> >if (S1[0] < Low[0])
> >Buy = 0;
> >else if (S1[0] > Low[0])
> >Buy = S1;
> >BuyPrice = S1;
> >if (R1[0] > High[0])
> >Sell = 0;
> >else if (R1[0] < High[0])
> >Sell = R1;
> >SellPrice = R1;
> >
> >THANKS Ernie
> >
> >
> >
> >
> >
> >
> >Please note that this group is for discussion between users only.
> >
> >To get support from AmiBroker please send an e-mail directly to
> >SUPPORT {at} amibroker.com
> >
> >For other support material please check also:
> >http://www.amibroker.com/support.html
> >
> >
> >Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
------------------------ Yahoo! Groups Sponsor --------------------~-->
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~->
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|