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

Re: [amibroker] Parabolic Stop Help request.



PureBytes Links

Trading Reference Links

this looks to the future for the next buy signal
fInitExtrmPr = ValueWhen (Buy, High, 0);
to look back to the last buy signal (or if current bar has buy signal) is
fInitExtrmPr = ValueWhen (Buy, High, 1);

same again
fInitStpLss = ValueWhen (Buy, (LLV(Low, 6),0) - 0.0020; ?? bracket
count wrong or missed a copy/paste
fInitStpLss = ValueWhen (Buy, LLV(Low, 6), 0) - 0.0020;


this below seems unnecessary way to reference current bar signal, and
has surplus information than needed
CondNewBuySignal =  (Ref (Buy, 0) == 1) AND (Ref (Buy, -1) ==0);
instead you could use
CondNewBuySignal =  Buy AND Ref(Buy, -1) ==0;

just to day Buy defaults to same as Buy==1, just as you have done in
the valuewhen functions

"// fPrBolicStpLss = Stuck here... Psuedo Code:
The initial stop is the lowest low of the last 6 bars since the Buy
Logic became true minus 0.0020."

in the AB AFL library there is a code placed there by Tomacz showing
how the SAR is constructed. You could use this to reverse engineer the
value you want

hope this helps



-- 
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm



On 8/31/05, Techguy <forex_bots@xxxxxxxxxxx> wrote:
> Dear Forum:
> 
> I am having some problems coding a Parabolic Stop. This is not a
> Parabolic Stop and Reverse (PSAR), just a parabolic stop which gets
> instantiated when a long or a short trade entry trigger is made. It
> will be for intraday data (15 Minutes), and I am only focusing on
> Long trades now.
> 
> I have two main problems that I can't figure out:
> 1.   How can I set the "Extreme Price" ? Please see code notes below
> for a description. The psuedo code would be : The High of the bar
> that the trade began, and thereafter, the Highest High since the
> trade began.
> 2.   How can I set the calculated parabolic stop price referencing
> the next bar into future?
> 
> Here is what I have so far:
> 
> ///////////////////////////////////////////////////////////
> // Set up the Parabolic Stop.
> // The standard formula for the parabolic stop is:
> // Parabolic Stop price for the NEXT bar = the current Parabolic
> Stop OR the
> // Initial Stop Loss price
> // (LLV of last 6 bars minus 20 pips) if this is the very first bar
> of the
> // trade) +
> // (Acceleration Factor * (Extreme Price - Parabolic Stop (current
> bar)))
> 
> // The Acceleration Factor; the default value begins at 0.02 and
> increments by
> // 0.02 on each subsequent bar,  to a maximum value of 0.20.
> 
> // The "Extreme Price" since the trade was initiated is equal to the
> Highest
> // High since the trade began.
> 
> // Variable initialization:
> 
> // Initialize the Extreme Price from todays High if Buy conditions
> are met.
> fInitExtrmPr = ValueWhen (Buy, High, 0);
> 
> // fExtremePrice = ??? Psuedo Code. The High of the first bar of the
> trade or the Highest High since the trade began.
> 
> Question: How can I keep this variable from taking on new values
> each time the Buy logic is satisfied AND I am already in a trade?
> Can Exrem or ExRemSpan be incorporated?
> 
> // Initial Acceleration Factor.
> fInitAccFact = Optimize ("Init Accl Fct", 0.02, 0.01, 0.10, 0.01);
> 
> // Subsequent additional acceleration if there is a new higher high
> during the trade.
> fSubsqAccFact = Optimize ("Subsq Accl Fct", 0.02, 0.01, 0.10, 0.01);
> 
> // Maximum Parabolic Stop acceleration factor.
> fMaxAccFact = Optimize ("Max Accl Fct", 0.02, 0.01, 0.40, 0.01);
> 
> // Set the initial Stoploss to the Lowest Low Value of the last 6
> bars if Buy // is true, minus 20 pips (FOREX).
> fInitStpLss = ValueWhen (Buy, (LLV(Low, 6),0) - 0.0020;
> 
> // Initialize a Boolean Flag that we are in a trade.
> bInLngTrd = 0;
> 
> // Attempt to set a Boolean flag that we are in a trade if Buy logic
> becomes
> // true.
> CondNewBuySignal =  (Ref (Buy, 0) == 1) AND (Ref (Buy, -1) ==0);
> 
> IIf (CondNewBuySignal == 1, bInTrdLng = 1, Null);
> 
> // fPrBolicStpLss = Stuck here... Psuedo Code:
> The initial stop is the lowest low of the last 6 bars since the Buy
> Logic became true minus 0.0020.
> There after the parabolic stop is equal to The Current Bars Stop
> 
> // Apply a Trailing Stop that utilizes the Parabolic Stop and
> increments by points.
> ApplyStop (stopTypeTrailing, stopModePoint, fPrBolicStpLss,
> ExitAtStop = 2, True, 0);
> 
> _______________________________________________
> 
> That's what I have so far. Any help or concepts I'm not getting
> appreciated.
> 
> Thanks,
> 
> 
> Denton
> 
> 
> 
> 
> 
> 
> 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 other support material please check also:
> http://www.amibroker.com/support.html
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Put more honey in your pocket. (money matters made easy).
http://us.click.yahoo.com/r7D80C/dlQLAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

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