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

Re: [amibroker] Re: How to set the "amount" in ApplyStop(stopTypeTrailing, stopModePoint,amount,1,1,1)


  • To: <amibroker@xxxxxxxxxxxxxxx>
  • Subject: Re: [amibroker] Re: How to set the "amount" in ApplyStop(stopTypeTrailing, stopModePoint,amount,1,1,1)
  • From: "Tomasz Janeczko" <amibroker@xxxxxx>
  • Date: Fri, 13 Jan 2006 17:32:14 +0100

PureBytes Links

Trading Reference Links

Hello,

I instructed Marcin to find your original message and reply.

As for ApplyStop itself it has no known problems and 
it is very nicely documented in the User's guide and
at http://www.amibroker.com/f?applystop

Your problems probably come from lack of coding experience
and as soon as we find your original enquiry we will reply via
support channel.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Joe" <j0etr4der@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, January 13, 2006 5:09 PM
Subject: [amibroker] Re: How to set the "amount" in ApplyStop(stopTypeTrailing, stopModePoint,amount,1,1,1)


> The primary reason is I want the tool to do the work it was designed 
> for - why should each of us have to write and debug our own stop 
> code?.  Setting stops is (or should be) a basic function and should 
> be bullet proof.  I'll bet there are hundreds of versions of stop 
> code and many have bugs ( I know the versions I wrote do.)  
> 
> Secondly, in order for my hand-coded stops to exit intraday in an 
> EOD trading system, I have to (?) change SetTradeDelays in the 
> loop.  What subtle effects that might have on, say Equity(1), I have 
> no way of knowing, and a code change in a future version may have an 
> impact.  If I could use Applystop, then those effects would be found 
> in testing or beta.
> 
> For quite a whileI though that I'm missing something, that there was 
> some obvious answer that I was too ignorant to understand.  But 
> nearly every week someone else asks for help on Applystop - because 
> is it poorly and incompletely documented, and it does not work 
> correctly.  I've ask AB Support and this forum how to use the output 
> of the SafeZone stop code as the input for trailing stop in 
> Applystop.  No one to date has an answer, except to write my own. 
> 
> By the way, in the 4.75BETA, there is an intermitent (means I 
> couldn't figure what triggers it :-) bug when using this code:
> ApplyStop( stopTypeProfit, stopModePoint, Profit_Amount, 
> Exitatstop=1, Reentrydelay=2)
> where a few of the Sell(profit) trades are big losses with the exit 
> price being a small integer.  I reported it, with documentation, on 
> Jan. 6th.  Haven't heard anything since.
> 
> IMHO, AB development should put a hold on new features that only a 
> few percent of us use, and fix and document Applystop. 
> 
> Thanks for the replies, 
> 
> /joe
> 
> -- In amibroker@xxxxxxxxxxxxxxx, "cstrader" <cstrader232@xxxx> wrote:
>>
>> Joe:
>> 
>> Why do you need the applystop if you're using a loop?  The loop 
> can create the sells for you.
>> 
>> 
>>   ----- Original Message ----- 
>>   From: Joe Bolton 
>>   To: AB 
>>   Sent: Monday, January 09, 2006 5:01 PM
>>   Subject: [amibroker] How to set the "amount" in ApplyStop
> (stopTypeTrailing, stopModePoint,amount,1,1,1)
>> 
>> 
>>   Greetings,
>> 
>>   I am trying to implement the Elder Safe Zone stop from code I 
> got from the library and elsewhere.  Try as I might (and it's been a 
> while), I cannot determine how to convert the stop price I get from 
> the SZ calculation into the "amount" for a trailing stop. I have 
> searched Help, the AB site and newsgroups here but have not found 
> any useful information on how to make this work or how AB handles a 
> trailing stop.  
>> 
>>   As you can see below, I have approximated a trailing stop, but 
> it has the disadvantage of using the the next day's open when the 
> actual stop is greater than the next day's prices and it does not 
> exit intraday. 
>> 
>>   The setup for EOD trading, exiting intraday is in my formula -- 
> the profit stop I've coded works as expected.  Following the work-
> around for the trailing stop is the code I started for the trailing 
> Applystop, bu t of course the code for the "amount" is wrong.  What 
> is there is the closest I could come to getting the right amount and 
> it's very wrong.
>> 
>>   Thank you for any help you can provide.
>> 
>>   TrailingStop = 4; //simulate trailing stop
>>   LookbackPeriod = 8;//Optimize("SZLkBk",12,4,12,1); //Set 
> Lookback period 
>>   AvgDnPenCoeff = 1.9;//;//Optimize("SZLongCoeff", 1.35, 1.5, 3.5, 
> 0.1); //
>>   DownPen = IIf(Low < L1, L1 - Low, 0); //Identify amount of each 
> penetration -- O=none
>>   DownPenSum = Sum(DownPen,LookbackPeriod); //Total volume of 
> penetrations during the lookback period
>>   DownPenCount = Sum(Low < L1, LookbackPeriod); //Number of 
> penetrations during lookback period
>>   AvgDownPen = DownPenSum/DownPenCount; //Average penetration 
> amount during lookback period
>>   AvgDownPen = Nz(AvgDownPen, 0);//Insure it is not NAN
>>   DownPenSum = Sum(DownPen, LookbackPeriod); //Total volume of 
> penetrations during the lookback period
>>   SafeZoneLong = L1 - (AvgDownPen*AvgDnPenCoeff); // "Place your 
> stop at a multiple of yesterday's AveDownPen below yesterday's low."
>>   SafeZoneTrailLong = HHV( SafeZoneLong, BarsSince(Buy) + 
> 1 );//stop can' t drop during trade 
>>   SZStopLong = IIf( Low <= Ref( SafeZoneTrailLong, -1), True, 
> False); //the stop is trigger
>>   SZStopLong = ExRem(SZStopLong, Buy);//mask off secondary SZ 
> signals 
>>   //Trailing stop workaround
>>   for( i = 0; i < BarCount; i++ )
>>   {
>>   if( SZStopLong[i] == True ) 
>>   {
>>   SellPrice[i] = SafeZoneTrailLong[i];
>>   Sell[i] = TrailingStop;
>>   }
>>   }
>>   Plot(SafeZoneTrailLong, " SellStop", colorYellow, 
> styleStaircase);
>> 
>>   //How to make this work?
>>   SZTrailLong_Amount = High - Ref(SafeZoneTrailLong, - 1); //Wrong
>>   SZTrail_ExitAtStop = 1;
>>   SZTrail_Volatile = True;
>>   SZTrail_ReEntryDelay = 1;
>>   ApplyStop(stopTypeTrailing, stopModePoint, SZTrailLong_Amount, 
> SZTrail_ExitAtStop, SZTrail_Volatile, SZTrail_ReEntryDelay);
>> 
>>   Best regards,
>> 
>>   Joe
>> 
>> 
>> -------------------------------------------------------------------
> -----------
>>   Yahoo! Photos - Showcase holiday pictures in hardcover
>>   Photo Books. You design it and we'll bind it! 
>> 
>>   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 
>> 
>>     a..  Visit your group "amibroker" on the web.
>>       
>>     b..  To unsubscribe from this group, send an email to:
>>      amibroker-unsubscribe@xxxxxxxxxxxxxxx
>>       
>>     c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms 
> of Service. 
>> 
>> 
>> -------------------------------------------------------------------
> -----------
>>
> 
> 
> 
> 
> 
> 
> 
> 
> 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 --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/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/