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

Re: [amibroker] 'remebering' a value



PureBytes Links

Trading Reference Links

In an example of VBScript, Tomasz Janeczko wrote:

> close = AFL("close")
> buy = AFL( "buy" )
> sell = AFL("sell")
> ' this variable holds last buying price
> ' if it is zero it means that no trade is open

Is this the price at which one actually bought or the
last price for which conditions matched the buy criteria?
That is, will this get reset tomorrow if the buy conditions
are still met, as happens within AFL? Looks like it must.

I am still trying to find some way to do an exit of the form:

Sell on Open if BarsSince(Buy) > N AND Open > BuyPrice,

where the BarsSince function must not be reset each day
that meets the Buy conditions. Stephane was kind enough to
offer me some valuable help with this problem, but it seems
that there should be some way to do it within AFL.

Never did get an answer to my questions about how two
ApplyStops might be used for this. One of my notes should
appear in the archives; another went directly to you, Tomasz,
just as you were leaving on your trip. One ApplyStop should
operate as above, the other as a stop-loss. When I tried to
make it work, the settings from the Settings page overrode the
ApplyStop functions, no matter how I set that fourth parameter.
I have read the usual help file entries and archive messages,
but they did not clarify things for me.

Thanks.

Owen