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

[amibroker] Re: Exit Coding



PureBytes Links

Trading Reference Links

Hi Graham

I am only a novice coder
and similar to your associate,
don't know loops.
But as no response has come in two days
I will try to answer your question,
as I understand it.

As you know the

xaProfitStop 
xTimeStopPer     and
xaReversionValue

can be coded in AFL.

But I believe to include the

xDisasterStop 

your associate will have to stick with a loop.
I believe this because it has been often reaffirmed.
[See below]

If your associate can code MetaStock 
he/she could most likely understand the loop you have provided,
plug it in for the disaster stop in the future,
and possibly subtract or add sections as needed.

The good news is
in my experience,
to explore trading methods
the necessity for loops is rare.

directaim

==================

The way I see it, there is a logical problem with trying to do this
with purely array maths. I think it has to be done iteratively using a
loop.

The problem is that you want to create a buy array first, then use
HighestSince(Buy, ...) as part of the definition of the sell array.

What you really mean though is 
highest since the buy signal 
JUST IMMEDIATELY after the most-recent sell signal, 

but with array maths 
you can't reference a previous sell signal 
during the definition of the sell array. 

So you have a Catch-22 in that 
you can't remove redundant buy signals 
until the sell array has been defined, 
but can't define the sell array 
with HighestSince(Buy, ...) 
while there are redundant buy signals.

Unless array maths is changed to allow iterative definitions, whereby
an array could be defined based on earlier values of the same array in
the same statement, I think you will need to use a loop.

Regards,
GP
=============================
In short: RECURSIVE calculations need a FOR loop and [] operator
http://www.amibroker.com/guide/keyword/for.html

"For" loop and array subscript operator [] gives you access
to INDIVIDUAL values.

Best regards,
Tomasz Janeczko
==============================


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

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
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

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