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

TJ: Actual trade profit vs. Teoretical trade profit



PureBytes Links

Trading Reference Links

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