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

Re: [amibroker] SetBarsRequired() messing up AddToComposite()



PureBytes Links

Trading Reference Links

Yes I said that and I can simply re-confirm that.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Dennis Brown" <see3d@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Thursday, September 13, 2007 9:20 PM
Subject: Re: [amibroker] SetBarsRequired() messing up AddToComposite()


> Ara,
> 
> TJ said on Aug 6, 2007: "More likely than not, one of upcoming  
> versions will have "static arrays"."
> 
> I will make a formal suggestion or bug report as soon as I am  
> convinced that I am not at fault here.  I prefer to make sure I  
> understand the problems are real before cluttering up the bug reports  
> or suggestions with my errors in understanding --I have already made  
> that mistake a couple of times.
> 
> Best regards,
> Dennis
> 
> On Sep 13, 2007, at 2:12 PM, Ara Kaloustian wrote:
> 
>> Dennis,
>>
>> I did not dig into your code, but you seem to have spent a lot of  
>> time and
>> systematically isolated the issues / problems.
>>
>> TJ has stated that ATCs are best way to have static arrays and they  
>> are
>> fairly fast because they are cashed.
>>
>> TJ's plan (at least as far as I can understand) does not include  
>> any static
>> arrays in foreseeable future, as they are not any faster than ATCs.
>>
>> Clearly we do need static array functions and TJ's solution is, (at  
>> lease
>> for now)  ATCs.
>>
>> Seems like it would be appropriate to report this as a "bug" or make a
>> suggestion for improving the system behavior.
>>
>> The need for "static arrays" is obvious and will probably only  
>> increase.
>>
>> Ara
>> ----- Original Message -----
>> From: "Dennis Brown" <see3d@xxxxxxxxxxx>
>> To: <amibroker@xxxxxxxxxxxxxxx>
>> Sent: Thursday, September 13, 2007 10:14 AM
>> Subject: [amibroker] SetBarsRequired() messing up AddToComposite()
>>
>>
>>> Hello,
>>>
>>> I have made a number of posts in the past asking for help
>>> understanding how some AFL things work that were causing me
>>> problems.  Today, I see that some of these issues are related to each
>>> other.
>>>
>>> Most seem to be related to the number of bars that are loaded for an
>>> operation.
>>>
>>> 1.  SetBarsRequired()
>>>
>>> I reduce the number of bars for calculating some of my slow loops to
>>> increase speed.
>>> At TJ's suggestion, I also placed a SetBarsRequired(barHistory, 0);
>>> at the end of my AFL which overrides the Fast AFL settings.
>>> barHistory is set by parameter to the number of bars I want to see in
>>> my charts.
>>>
>>> This was a great help in AFL execution speed.  However, the
>>> SetBarsRequired() statement is peak detecting as long as the chart is
>>> running.  That means that if I want to see 50,000 bars instead of
>>> 2,000 bars for a moment, the number of bars loaded will go up to
>>> 50,000 when I increase them, but will never be reduced when I set the
>>> number back to 2,000.  So the slow down is permanent after that until
>>> I restart AB (or edit my chart AFL).  Not ideal from my perspective.
>>>
>>> 2.  AddToComposite()
>>>
>>> The first use of an AddToComposite() has the effect of requiring
>>> 1,000,000 bars back and 1,000,000 forward in fast AFL.  Once
>>> executed, you can never go back to fast AFL.
>>>
>>> This can have a bad side effect for some ATC uses.  In my case, I
>>> wanted to use an ATC ticker to hold flags to indicate a manual
>>> trade.  Normally my code only needs 2000 bars loaded.  When I load in
>>> the ticker with foreign() and modify a bar, then use ATC to write it
>>> back out, it does not write it out correctly The FIRST time.  This is
>>> because the number of bars required was less at the time the Foreign
>>> () function was executed and the number required for the ATC was all
>>> bars, which does not take effect until the next pass of AFL for the
>>> next Foreign() function execution.   This is messy to understand, and
>>> I do not fully comprehend all the details of it, except the first ATC
>>> write was not correct.
>>>
>>> However, the SetBarsRequired() command at the end of the AFL
>>> overrides this behavior, and keeps the number of bars the same as
>>> before.  This leads to a similar problem, only now every ATC write is
>>> bad unless the SetBarsRequired() command includes all bars, which
>>> defeats the purpose of speeding up the AFL.
>>>
>>> 3.  My questions
>>>
>>> Have I described what is happening correctly?
>>>
>>> How do I get the number of bars loaded to match the SetBarsRequired()
>>> command when I want to reduce the number?
>>>
>>> In order to have fast execution, am I going to have to abandon my use
>>> of ATC for saving static arrays?
>>>
>>> What other approach could I use to have high speed AFL and also be
>>> able to transfer array data between charts without using ATC?
>>>
>>>
>>> 4. The AFL which demonstrates the First ATC write problem :
>>>
>>> _SECTION_BEGIN("Manual Trades");
>>> // This section allows manual trades to be entered and saved
>>> permanently as a ticker
>>> // ~name1 is Buy flags
>>> // ~name2 is Sell flags
>>> // ~name3 is Short flags
>>> // ~name4 is Cover flags
>>>
>>> function saveManual(array, ManName)
>>> {AddToComposite(array ,ManName ,"x",atcFlagEnableInIndicator|
>>> atcFlagDefaults);}
>>>
>>> function saveAllManual(BuyMan, SellMan, ShortMan, CoverMan, ManName)
>>> {
>>> saveManual(BuyMan , ManName+"1");
>>> saveManual(SellMan , ManName+"2");
>>> saveManual(ShortMan , ManName+"3");
>>> saveManual(CoverMan , ManName+"4");
>>> }
>>>
>>> ManualName = ParamStr("Manual Trade Ticker", "~Kezha");
>>> createManual = ParamTrigger("Make Empty Ticker", "Make Empty  
>>> Ticker" );
>>> EnableManual = ParamToggle("Enable Manual Trades", "OFF|ON" );
>>> setbuy = ParamTrigger("Buy", "Buy" );
>>> setsell = ParamTrigger("Sell", "Sell" );
>>> setshort = ParamTrigger("Short", "Short" );
>>> setcover = ParamTrigger("Cover", "Cover" );
>>> clear = ParamTrigger("Clear", "Clear" );
>>>
>>> bi = BarIndex();
>>> sbi = SelectedValue( bi )-bi[0];
>>>
>>> if( createManual )
>>> {
>>> saveAllManual(0, 0, 0, 0, ManualName);
>>> }
>>>
>>> if( enableManual )
>>> {
>>> BuyMan = Foreign(ManualName+"1" ,"H");
>>> SellMan = Foreign(ManualName+"2" ,"H");
>>> ShortMan = Foreign(ManualName+"3" ,"H");
>>> CoverMan = Foreign(ManualName+"4" ,"H");
>>>
>>> if( setbuy ){BuyMan[sbi ] = 1; saveManual(BuyMan , ManualName+"1");}
>>> if( setsell ){SellMan[sbi ] = 1; saveManual(SellMan, ManualName 
>>> +"2");}
>>> if( setshort ){ShortMan[sbi ] = 1; saveManual(ShortMan, ManualName
>>> +"3");}
>>> if( setcover ){CoverMan[sbi ] = 1; saveManual(CoverMan, ManualName
>>> +"4");}
>>> if( clear )
>>> {
>>> BuyMan[sbi ] = 0;
>>> SellMan[sbi ] = 0;
>>> ShortMan[sbi ] = 0;
>>> CoverMan[sbi ] = 0;
>>> saveAllManual(BuyMan, SellMan, ShortMan, CoverMan, ManualName);
>>> }
>>> PlotShapes( BuyMan * shapeUpArrow,colorGreen,0,L,-25);
>>> PlotShapes( SellMan * shapeDownArrow ,colorRed ,0,H,-25);
>>> PlotShapes( ShortMan * shapeHollowDownTriangle ,colorRed ,0,H,-25);
>>> PlotShapes( CoverMan * shapeHollowUpTriangle,colorGreen,0,L,-25);
>>> }
>>> _SECTION_END();
>>>
>>> Thank you,
>>> Dennis Brown
>>>
>>>
>>> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>>> http://www.amibroker.com/devlog/
>>>
>>> For other support material please check also:
>>> http://www.amibroker.com/support.html
>>>
>>> Yahoo! Groups Links
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> http://www.amibroker.com/devlog/
>>
>> For other support material please check also:
>> http://www.amibroker.com/support.html
>>
>> Yahoo! Groups Links
>>
>>
>>
> 
> 
> 
> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> 
> Yahoo! Groups Links
> 
> 
> 
> 
>


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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

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