PureBytes Links
Trading Reference Links
|
Hi - OK, try this code instead
NR4DayYest = ref( NR4Day, -1 ); // new array
- NR4Day shifted forward 1 bar
InsideDayYest = ref( InsideDay, -1 ); // new array
- InsideDay shifted forward 1 bar
HigherHigh = High > ref( High, -1
);
LowerLow = Low < ref( Low, -1 );
Buy =
NR4DayYest AND InsideDayYest AND HigherHigh;
Short =
NR4DayYest AND InsideDayYest AND LowerLow;
----- Original Message -----
Sent: Saturday, April 19, 2008 5:50
PM
Subject: Re: [amibroker] Re: Why do I get
"missing buy/sell variable assignmets" error?
Yes I want to take the trade if
today is higher/lower and the other conditions were met yesterday as you
said.
This is exactly right.
So we made an inside day
which was also an NR4Day and then once this bar has been broken to the upside
or downside a trade is triggered.
thank you
On Sat, Apr 19, 2008 at 10:41 PM, Steve Dugas < sjdugas@xxxxxxxxxxx> wrote:
Hmm...good thinking, I guess it is tough to
make a new high on an inside day. 8 - )
Sorry, I was paying attention to structuring
the code instead of the actual conditions.
So, did you want to take the trade if today is
higher/lower and the other conditions were met yesterday? If not, please
state clearly what your entry conditions are. Thanks!
Steve
-----
Original Message -----
Sent:
Saturday, April 19, 2008 5:16 PM
Subject:
Re: [amibroker] Re: Why do I get "missing buy/sell variable assignmets"
error?
Cheers Steve I tried the extra code but Im not
getting any trades now. Is it because Im not going to get NR4Day AND
InsideDay AND HigherHigh at the same
time?as per the "Buy = NR4Day AND InsideDay
AND HigherHigh;" string.
Please bear with me if Im misunderstanding
this but wouldn't I get
NR4Day AND
InsideDay
then I will need to tell AB to trigger a trade on
HigherHigh but not as an AND with the other
conditions.
Really appreciate the
help.
AH
On Sat, Apr 19, 2008 at 7:38 PM, Steve Dugas < sjdugas@xxxxxxxxxxx> wrote:
Hi - You seem to be confusing the Explorer
with the Backtester. "Filter" keyword is required for Exploration mode
but is not recognized as anything special by the backtester, so you
might want to assign your trade rules directly to
Buy/Sell/Short/Cover and not use the Filter for that. Also,
you need to use the Custom Backtest Interface to add columns to a
backtest report.
OTOH, the Explorer requires the Filter
keyword to filter which results it will show you, and you will also need
to use AddColumn() and/or AddTextColumn() to add columns to an
exploration report.
But anyway, something like this
should get you into your trades..
HigherHigh = High > ref( High, -1
);
LowerLow = Low < ref( Low, -1
);
Buy =
NR4Day AND InsideDay AND HigherHigh;
Short =
NR4Day AND InsideDay AND LowerLow;
To close out the short positions, you
should also define the Cover variable.
Steve
-----
Original Message -----
Sent:
Saturday, April 19, 2008 1:58 PM
Subject:
Re: [amibroker] Re: Why do I get "missing buy/sell variable
assignmets" error?
Thanks again I now have the buy order
working in backtest mode with the code below and instead of using
"Applystop" have used Sell = L < Ref(LLV(L,2),-1); to close the
position but can't work out how to do the following Buy order
is currently opening as soon as the "Filter" criteria is met. I
actually want it to open a buy only when "Filter" is true
AND the next bar creates a higher high or to open a short when
"Filter is true and next bar creates a lower low. I have tried
quite a few ways of doing this but am not sure how to make AB straddle
a bar and open a trade when it is broken in either
direction. -------------- NR4Day = (H - L) <
Ref(LLV(H-L,3),-1); Column1 = NR4Day; Column1Name =
"Nr4Day"; InsideDay = H < Ref(High,-1) AND Low >
Ref(Low,-1); Column2 = InsideDay; Column2Name = "Inside
Day"; Column3 = High + 0.125; Column3Name = "Buy
Stop"; Column4 = Low - 0.125; Column4Name = "Sell
Stop"; Filter = NR4Day == 1 AND InsideDay == 1; Buy =
Filter Sell = L < Ref(LLV(L,2),-1);
On Sat, Apr 19, 2008 at 4:48 PM, Steve Dugas
< sjdugas@xxxxxxxxxxx> wrote:
Hi - In AA settings, you probably have
Positions set to "Long and Short" so AB is expecting to see Short
and Cover defined. You could either change settings to Long only or
add this to your code...
Short = Cover = 0;
Steve
-----
Original Message -----
Sent:
Saturday, April 19, 2008 6:05 AM
Subject:
Re: [amibroker] Re: Why do I get "missing buy/sell variable
assignmets" error?
Thanks for your help.
I now get "missing
short/cover variable assignment" after adding the Sell = 0;
string
Going throught the amibroker documentation but
appreciate any help while I am new to this.
On Sat, Apr 19, 2008 at 9:40 AM,
jamesfarrow2003 < jamesfarrow2003@xxxxxxxxx> wrote:
I wouls just enter the line:
Sell = 0;
Then set
your stops using the GUI or via code, whichever is desired.
--- In amibroker@xxxxxxxxxxxxxxx, "alta hob"
<altahob@xxx> wrote: > > I`m trying to run
this code as a simple backtest but get "missing
buy/sell > variable assignmets" error. Have tried
adding > > ApplyStop( stopTypeNBar, stopModeBars, 5
); > > but still get error. Can someone please
advise what I need to do to run > as a simple backtest
with a trailing bar stop? > > thanks >
> altahob > ---------- > /* Connors and
Raschke Historical Volatility System > For further
explanation, refer to "Street Smarts" > from Connors and
Raschke. > Ported from Metastock code by Daniel Ervi
*/ > > numcolumns = 5; > > VolRatio =
StDev(Log(C/Ref(C,-1)),5) / StDev(Log(C/Ref(C,-1)),99); >
column0 = VolRatio; > column0name = "VolRatio"; >
> NR4Day = (H - L) < Ref(LLV(H-L,3),-1); >
column1 = NR4Day; > column1name = "Nr4Day"; >
> InsideDay = H < Ref(High,-1) AND Low >
Ref(Low,-1); > column2 = InsideDay; > column2name =
"Inside Day"; > > column3 = High + 0.125; >
column3name = "Buy Stop"; > > column4 = Low -
0.125; > column4name = "Sell Stop"; > >
filter = VolRatio < 0.5 AND (NR4Day == 1 AND InsideDay ==
1); > > buy =
filter; >
__._,_.___
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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
__,_._,___
|
|