Hello,
Im building system:
1. that goes long only ie. buys down bar in
uptrend
2. that goes short only ie. shorts up bar in
downtrend
3. goes long and short when both trends are
present
The problem is that it signals error because IF
loop has to be numeric and not aray.
Could anyone point me to where I can find solution for
this problem ?
It goes like this
// CODE BEGINN ********** 3 in 1 EOD system
p=20;
uptrend=RSI(p) >55; dwtrend=RSI(p) < 45; DIR=IIf(
uptrend,5 ,IIf( dwtrend,4 ,7)); // direction up down both
u1=C >O;// trigger d1=C < O;
if( dir==5) { // LONGS Buy=d1*
dir==5; Sell=u1*dir==5; Short=0; Cover=0; }
if( dir==4) { //
SHORTS Buy=0; Sell=0; Short=u1*dir==4; Cover=d1*dir==4; } if(
dir==7) { // BOTH Buy=d1*
dir==7; Sell=u1*dir==7; Short=u1*dir==7; Cover=d1*dir==7; }
else;
//
// *****************END CODE
I tried this combination but it is not working:
p=20;
uptrend=RSI(p) >55; dwtrend=RSI(p) < 45; DIR=IIf(
uptrend,5 ,IIf( dwtrend,4 ,7)); // direction up down both
u1=C >O;// trigger d1=C < O;
for(i=1;i<BarCount;i++) {
if (dir[i]==5) Buy=d1*
dir==5; Sell=u1*dir==5; Short=0; Cover=0;
if (dir[i]==4)
Buy=0;
Sell=0;
Short=u1*dir==4;
Cover=d1*dir==4;
if (dir[i]==7)
//
BOTH
Buy=d1* dir==7;
Sell=u1*dir==7;
Short=u1*dir==7;
Cover=d1*dir==7; }
__._,_.___
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
__,_._,___
|