PureBytes Links
Trading Reference Links
|
John,
The idea is that Buy signal depends on past value of tradeProfit
variable at time when last Sell signal was.
On the other side current value of tradeProfit variable is calculated
on BuyPrice and SellPrice values when Buy and Sell signals happened
respectively.
Mike
--- In amibroker@xxxx, "nirvana1x" <nirvanaiam@xxxx> wrote:
> Mike i am having some trouble understanding what you ask.
>
> looking at youre simple formula below
>
> (Buy = longEntry and ValueWhen(Sell, tradeProfit) < 0;
> Sell = LongExit;)
>
> do you want the long entry condition to be true first, then have
> the sell condition at a certain profit level to place a buy as an
> entry.
> and is your sell condition (long exit) the next true sell(long
> exit) condition or do you want it to be the sell which the buy is
> based on.
>
> john.
>
>
> --- In amibroker@xxxx, "mik954" <mik-u@xxxx> wrote:
> > Hi, all!
> >
> > Well, so far no any response on my initial post (even on direct e-
> > mail to support@xxxx). It's weird. Maybe my question wasn't
> > clear, or Tomasz was too busy.
> >
> > OK, let me ask in a different way. Is there any way in AFL to
> declare
> > variable/array and use its previos value before setting current
one?
> >
> > I mean:
> >
> > // var tradeProfit; // declare variable for future use
> >
> > Buy = longEntry and ValueWhen(Sell, tradeProfit) < 0;
> > Sell = LongExit;
> >
> > tradeProfit = ValueWhen(Sell, SellPrice) - ValueWhen(Buy,
BuyPrice);
> >
> >
> > Any suggestions are welcome.
> >
> > Thanks,
> > Mike
> >
> >
> > --- In amibroker@xxxx, "mik954" <mik-u@xxxx> wrote:
> > > Tomasz,
> > >
> > > On February 22, 2002 you wrote the code for teoretical trade
> profit:
> > >
> > > <<<cut here>>>
> > >
> > > Let's suppose that you system generates
> > > entry and exit signals based on break out:
> > >
> > > LongEntry = ... formula here ...
> > > LongExit = .... formula here...
> > >
> > > Now you can
> > >
> > > LongEntry = ExRem( LongEntry, LongExit );
> > > LongExit = ExRem( LongExit, LongEntry );
> > >
> > > TheoreticalTradeProfit = ValueWhen( LongExit, SellPrice ) -
> > > alueWhen( LongEntry, BuyPrice );
> > >
> > > Buy = LongEntry AND TheoreticalTradeProfit < 0; // enter only
if
> > > previous trade was loosing
> > > Sell = LongExit;
> > >
> > > <<<cut here>>>
> > >
> > > Could you tell me please how in AFL I may calculate trade
profit
> > > based on ACTUAL Buy/Sell signals to use previos profit value in
> > next
> > > Buy signal calculation?
> > >
> > > I mean a code like this:
> > >
> > > <<<cut here>>>
> > >
> > > var tradeProfit; // declare variable for future use
> > >
> > > Buy = longEntry and Ref(tradeProfit, -1) < 0;
> > > Sell = LongExit;
> > >
> > > tradeProfit = ValueWhen( Sell, SellPrice ) - ValueWhen( Buy,
> > > BuyPrice );
> > >
> > > <<<cut here>>>
> > >
> > >
> > > Thanks,
> > > Mike
|