PureBytes Links
Trading Reference Links
|
possibly a way to achieve this would be to use a loop
The following is just typed straight into here so maybe syntax and/or
logic errors
provided as example only
Cond1 = Ref(C,1) > Ref(C,0);
Cond2 = Ref(C,-2) > Ref(C,-1);
Buy = Cond1 AND Cond2;
Sell=0;
InTrade = 0;
for(i=2;i<barcount;i++)
{
if(buy[i] and Intrade[i-1]==0)
{
Intrade=1;
buyprice[i]=O[i];
}
else
{
buyprice[i]=buyprice[i-1];
InTrade[i] = Intrade[i-1];
}
if( O[i]<buyprice[i] and O[i-1]>=buyprice[i-1] )
{
Intrade[i]=0;
Sell[i]=1;
}
else
{
Sell[i]=0;
Intrade[i]=Intrade[i-1];
}
}
On 8/6/05, Peter <pa299@xxxxxxxxxxxxx> wrote:
> Graham
> Thanks
> The problem I have is how to use the BuyPrice in the sell line. The
> Flip line has to be below the Buy & Sell lines, and the BuyPrice
> line after the Flip. However the sell line uses the value of the
> BuyPrice which it never gets because its last.
> Or is the problem me?
> Cheers.
> Peter
>
>
>
> Cond1 = Ref(C,1) > Ref(C,0);
> Cond2 = Ref(C,-2) > Ref(C,-1);
>
> Buy = Cond1 AND Cond2;
> Sell = Cross(Open,BuyPrice);
>
> InTrade = Flip(Buy,Sell);
> BuyPrice = ValueWhen( Intrade AND Ref(InTrade,-1)==0, Open );
>
>
>
>
>
>
>
> 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
>
>
>
>
>
>
>
>
--
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="http://us.ard.yahoo.com/SIG=12hic8kta/M=362343.6886682.7839641.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1123303945/A=2894350/R=0/SIG=10tj5mr8v/*http://www.globalgiving.com">Make a difference. Find and fund world-changing projects at GlobalGiving</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/
|