Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
redrunner, You have 'fixed' the logic error, but I am not sure whether you have maintained the intention of the original code (which also contained the same logic error)? redrunner wrote:Code:
Mplier:= If( C=EntryPrice, 2,
If( C < EntryPrice + 4*AvgTR, 3.5,
If( C < EntryPrice + 6*AvgTR, 3,
If( C >= EntryPrice + 6*AvgTR, 2.5,
PREV))));
NOTE: The PREV here is redundant because every condition is accounted for, there is no 'fall through' so could have been better wrirtten: Code:
Mplier:= If( C=EntryPrice, 2,
If( C < EntryPrice + 4*AvgTR, 3.5,
If( C < EntryPrice + 6*AvgTR, 3, 2.5)));
Using an example, lets say the EntryPrice is $1.00 As we are buying at the close, the very value of Mplier is when C=EntryPrice and is set to a value of 2. What happens if the closing price increases? If the close price deviates at all from the EntryPrice ($1.00) BUT it happens to be less than EntryPrice plus 4 AvTR then Mplier will be set to 3.5 If the close price is higher than EntryPrice plus 4 AvTR but less than EntryPrice plus 6 AvTR then Mplier will be set to 3. If the close price is higher than EntryPrice plus 6 AvTR then Mplier will be set to 2.5 What happens if the close is less than the EntryPrice? If the close price deviates at all from the EntryPrice ($1.00) BUT it happens to be less than EntryPrice plus 4 AvTR then Mplier will be set to 3.5 You were setting a WIDER stop if the price has fallen below the EntryPrice? This is where I thought the logic might have been wrong? The conditions should be? C <= Entry Price MPlier=2 C< EntryPrice + 4 AvTR MPlier=3.5 C< EntryPrice + 6 AvTR Mplier=3.0 otherwise (C>=EntryPrice + 6 AvTR) Mplier=2.5 Code:
Mplier:= If( C<=EntryPrice, 2,
If( C < EntryPrice + 4*AvgTR, 3.5,
If( C < EntryPrice + 6*AvgTR, 3, 2.5)));
or in the latch as: Code:
If(C<=PREV, 2,
If(C<PREV+4*AvgTR, 3.5,
If(C<PREV+6*AvgTR, 3, 2.5))))*AvgTR),
wabbit [:D]
|