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

RE: [amibroker] Re: Code help



PureBytes Links

Trading Reference Links

Hi,

 

i have modified your code so it works fine now.

 

 

 

BuySetup =

WMA(C,4)>WMA(C,12) AND ADX(14)>20 AND

PDI(14)>MDI(14) AND Cross(StochK(8,3),40) AND

C>EMA(C,25) AND EMA(C,64)>MA(C,64);

 

SellSetup = WMA(C,4)<WMA(C,12) AND ADX(14)>20 AND

PDI(14)<MDI(14) AND Cross(60,StochK(8,3)) AND

C<EMA(C,25) AND MA(C,64)>EMA(C,64);

 

BuyStopLevel = ValueWhen(BuySetup,High);

Buy = BarsSince(BuySetup)==1 AND Cross(High,BuyStopLevel);

BuyPrice = Max(Open,BuyStopLevel);

 

SellStopLevel = ValueWhen(SellSetup,Low);

Sell = BarsSince(SellSetup)==1 AND Cross(SellStopLevel,Low);

SellPrice = Min(Open,SellStopLevel);

 

Filter= Buy OR Sell;

AddColumn( Buy, "Bullish", 1 );

AddColumn( Sell, "Bearish", 1 );

AlertIf( Buy, "SOUND D:\WINDOWS\Media\Windows XP Startup.wav", "Audio alert", 1 );

AlertIf( Sell, "SOUND D:\WINDOWS\Media\Windows XP Shutdown.wav", "Audio alert", 2 );

 

Plot(C,"C",1,128);

PlotShapes(BuySetup*shapeHollowSmallUpTriangle,colorLime,0,L,-12);

PlotShapes(Buy*shapeSmallCircle,colorLime,0,BuyPrice,0);

PlotShapes(SellSetup*shapeHollowSmallDownTriangle,colorRed,0,H,-12);

PlotShapes(Sell*shapeSmallCircle,colorRed,0,SellPrice,0);

 

Title =

EncodeColor(colorBlue)+

"BuyStopLevel = " + WriteVal(Buystoplevel,1.4)+

EncodeColor(colorRed)+

"\nSellStopLevel = " + WriteVal(Sellstoplevel,1.4);

 

- - - - - - - - - - - - - - - - - - - -

Best regards

 

Thomas

www.tradingbasis.com

support@xxxxxxxxxxxxxxxx

- - - - - - - - - - - - - - - - - - - -

 

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of iascool
Sent: Friday, January 27, 2006 2:41 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Code help

 

 

Hello Thomas ,

I tried your suggestion, but the signals are far from

accurate .Ideally the buy shd be immediatetly above the high of

condition 1 and sell below low of condition2.

Have I messed up with the code , PLs advise

 

Cond1= WMA(C,4)>WMA(C,12) AND ADX(14)>20 AND PDI(14)>MDI(14) AND

Cross

(StochK(8,3),40) AND C>EMA(C,25) AND EMA(C,64)>MA(C,64);

Cond2= WMA(C,4)<WMA(C,12) AND ADX(14)>20 AND PDI(14)<MDI(14) AND

Cross

(60,StochK(8,3)) AND C<EMA(C,25) AND MA(C,64)>EMA(C,64);

BuySetup = Cond1;

BuyStopLevel = ValueWhen(Cond1,High);

Buy = BarsSince(BuySetup)<=1 AND Cross(High,BuyStopLevel);

BuyPrice = Max(Open,BuyPrice);

SellSetup = Cond2;

SellStopLevel = ValueWhen(Cond2,Low);

Sell = BarsSince(SellSetup)<=1 AND Cross(Low,SellStopLevel);

SellPrice = Max(Open,SellPrice);

Filter= Buy OR Sell;

AddColumn( Buy, "Bullish", 1 );

AddColumn( Sell, "Bearish", 1 );

AlertIf( Buy, "SOUND D:\WINDOWS\Media\Windows XP

Startup.wav", "Audio alert", 1 );

AlertIf( Sell, "SOUND D:\WINDOWS\Media\Windows XP

Shutdown.wav", "Audio alert", 2 );

 

--- In amibroker@xxxxxxxxxxxxxxx, "iascool" <sai20_2000@xxxx> wrote:

> 

>

>  HI Thomas

> Thanks for your feedback , I ll try your suggestion.

> Regards

>

> In amibroker@xxxxxxxxxxxxxxx, "Thomas Z." <tzg@xxxx> wrote:

> >

> > Hi,

> >

> > 

> >

> > you can do this with the valuewhen function.

> >

> > So you write something like:

> >

> > 

> >

> > BuySetup = Cond1;

> >

> > BuyStopLevel = ValueWhen(Cond1,High);

> >

> > Buy = BarsSince(BuySetup)<=1 AND Cross(High,BuyStopLevel);

> >

> > BuyPrice = Max(Open,BuyPrice);

> >

> > 

> >

> > 

> >

> > - - - - - - - - - - - - - - - - - - - -

> >

> > Best regards

> >

> > 

> >

> > Thomas

> >

> > www.tradingbasis.com <http://www.tradingbasis.com/>

> >

> > support@xxxx

> >

> > - - - - - - - - - - - - - - - - - - - -

> >

> > 

> >

> > -----Original Message-----

> > From: amibroker@xxxxxxxxxxxxxxx

[mailto:amibroker@xxxxxxxxxxxxxxx]

> On Behalf

> > Of iascool

> > Sent: Tuesday, January 24, 2006 2:18 PM

> > To: amibroker@xxxxxxxxxxxxxxx

> > Subject: [amibroker] Code help

> >

> > 

> >

> > In the following code I like to trigger the buy or sell when the

> >

> > high/low of the signal bar is breached .I have made changes with

> >

> > highestsince/lowestsince  , but it donot work . Any suggestions

> please.

> >

> > 

> >

> > //

> >

> > Cond1= WMA(C,4)>WMA(C,12) AND ADX(14)>20 AND PDI(14)>MDI(14) AND

> Cross

> >

> > (StochK(8,3),40) AND C>EMA(C,25) AND EMA(C,64)>MA(C,64);

> >

> > Cond2= WMA(C,4)<WMA(C,12) AND ADX(14)>20 AND PDI(14)<MDI(14) AND

> Cross

> >

> > (60,StochK(8,3)) AND C<EMA(C,25) AND MA(C,64)>EMA(C,64);

> >

> > Buy=HighestSince(Cond1,C,5); Sell=LowestSince(Cond2,C,5);

> >

> > Filter =Buy OR Sell;

> >

> > AddColumn( Buy, "Bullish", 1 );

> >

> > AddColumn( Sell, "Bearish", 1 );

> >

> > 

> >

> > Regards

> >

> > sai

> >

> > 

> >

> > 

> >

> > 

> >

> > 

> >

> > 

> >

> > 

> >

> >

> > 

> >

> > 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

> >

> > 

> >

> >     http://groups.yahoo.com/group/amibroker/

> >

> > 

> >

> >     amibroker-unsubscribe@xxxxxxxxxxxxxxx

> >

> > 

> >

> >     http://docs.yahoo.com/info/terms/

> >

> 

 

 

 

 

 

 

------------------------ Yahoo! Groups Sponsor --------------------~-->

Try Online Currency Trading with GFT. Free 50K Demo. Trade

24 Hours. Commission-Free.

http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/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/

 

 

 



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





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS