[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: 3 in 1 trading system



PureBytes Links

Trading Reference Links

 
 
Tomasz and Barry thanx for help. I ll look into it.
 
 
----- Original Message -----
Sent: 3. rujan 2008 20:55
Subject: [amibroker] Re: 3 in 1 trading system

I don't think you need the for loop or iif(...).
you can use logic statements something like this:

buy = sell = short = cover = False;

// LONGS
buy = di AND uptrend AND !dwtrend;
Sell= u1 and uptrend AND !dwtrend;

// SHORTS
Short = u1 AND dwtrend AND !uptrend;
Cover = d1 AND dwtrend AND !uptrend;

// BOTH
Buy = Cover = di AND uptrend AND dwtrend;
Sell= Short = u1 AND uptrend AND dwtrend;

Barry

--- In amibroker@xxxxxxxxxps.com, "DrazenStricek12" <dstricek12@...>
wrote:
>
> 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;
> }
>



__________ NOD32 3412 (20080903) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com
__._,_.___

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




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___