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

RE: [amibroker] Re: Referencing the last Actual entry signal.



PureBytes Links

Trading Reference Links

Graham

 

I can see how the flip works but can’t make it work in this situation.

 

The system I'm trying to code has two exits, an  'exit at the first profitable open' and a Points Stop.

ApplyStop doesn’t return anything so can’t used as the SellSig.   e.g. SellSig  = ApplyStop(stopTypeLoss, stopModePoint, 40, 1, False, 0);

 

An  'exit at the first profitable open'  has to reference the original buy array to work out if the open is profitable and the problem is doing that as well as removing the excessive buy signals.

 

I’ve changed the code around and  successfully extracted the ActualBuyPrice but can’t work out why the line

RefActualBuyPrice= Ref(ActualBuyPrice,-1);

always returns zero.

 

Any help would be gratefully accepted????

Peter (from across the ditch)

 

 

 

RefActualBuyPrice[0] = Open[0];

ActualBuyPrice [0] = Open[0];

 

Cond1 = Ref(C,1) > Ref(C,0);

Cond2 = Ref(C,-2) > Ref(C,-1);

 

Buy = Cond1 AND Cond2;

BuyPrice = ValueWhen(Buy,O);

 

 

// Why does ‘RefActualBuyPrice’ this return zero??

RefActualBuyPrice= Ref(ActualBuyPrice,-1);

 

//  This would be the 1sd profitable exit line???

//Sell = Ref(Open,0) > RefActualBuyPrice;

 

Sell = Ref(Open,0) > BuyPrice;

SellPrice = Ref(O,0);

 

Buy = ExRemBuyTest = ExRem( Buy, Sell );

Sell = ExRemSellTest =ExRem( Sell, Buy );

 

ActualBuyPrice = ValueWhen(ExRemBuyTest== 1 ,O);

 

PointStop = ApplyStop(stopTypeLoss, stopModePoint, 40, 1, False, 0);

 

 

"1sd Profitable Open Commentary";

"";

"Cond1 is " + WriteVal(Cond1);

"Cond2 is " + WriteVal(Cond2);

"";

"Buy is " + WriteVal(Buy);

 

"RefActualBuyPrice is " + WriteVal(RefActualBuyPrice);

 

"ExRemBuyTest value is " + WriteVal(ExRemBuyTest );

"Bars since ExRemBuyTest == 1 " + WriteVal(BarsSince(ExRemBuyTest== 1 ));

"";

"BuyPrice is " + WriteVal(BuyPrice );

"ActualBuyPrice is " + WriteVal(ActualBuyPrice);

 

 

 

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Graham
Sent: Saturday, 6 August 2005 5:22 p.m.
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Re: Referencing the last Actual entry signal.

 

I got to thinking about the afl code that was used and my loopy answer

the sell was just provided as a stoploss, normally you would have a

sell for trailing prices, or a certain occurence and also have a

stoploss as protection

so will rewrite this yo include normal sell

 

Cond1 = Ref(C,1) > Ref(C,0);

Cond2 = Ref(C,-2) > Ref(C,-1);

 

Buy = Cond1 AND Cond2;

SellSig = YourNormalSellTrailingConditions;

 

InTrade = Flip(Buy,SellSig);

 

BuyPrice =  ValueWhen(  Intrade AND Ref(InTrade,-1)==0, Open );

 

Sell = SellSig OR Cross(Open,BuyPrice);

 

 

 

--

Cheers

Graham

AB-Write >< Professional AFL Writing Service

Yes, I write AFL code to your requirements

http://e-wire.net.au/~eb_kavan/ab_write.htm

 

 

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

<font face=arial size=-1><a href="">

">Put more honey in your pocket. (money matters made easy) Welcome to the Sweet Life - brought to you by One Economy</a>.</font>

--------------------------------------------------------------------~->

 

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





YAHOO! GROUPS LINKS