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

Re: [amibroker] Re: Resetting an indicator at the start of a session



PureBytes Links

Trading Reference Links

Dingo, Sidhartha70,

Sorry, I thought the question about starting the indicator over each  
trading session (ie., trading day).

BR,
Dennis

On May 20, 2008, at 12:48 PM, dingo wrote:

> IMHO you should seriously read thru the list of functions in the  
> help file.
> And you should do this at least twice per year.
>
> Look at the "stocknum" param in the following:
>
> http://www.amibroker.com/guide/afl/afl_view.php?id=141
>
> You can test to see if the result is = 0 which will indicate the  
> start.
>
> d
>
>> -----Original Message-----
>> From: amibroker@xxxxxxxxxxxxxxx
>> [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of sidhartha70
>> Sent: Tuesday, May 20, 2008 12:29 PM
>> To: amibroker@xxxxxxxxxxxxxxx
>> Subject: [amibroker] Re: Resetting an indicator at the start
>> of a session
>>
>> Dennis,
>>
>> Thank you. I will take a look at the code.
>>
>> First question... goodness. Is there a really easy way to know if we
>> are at the start of a session...?? A flag of some sort that gets set
>> at the start of the session...?
>>
>> Sorry, I come from C# world...
>>
>> Thanks
>>
>> --- In amibroker@xxxxxxxxxxxxxxx, Dennis Brown <see3d@xxx> wrote:
>>>
>>> Hello,
>>>
>>> Here is a snippet of AFL from my system that is concerned
>> with what
>>> you are looking for.  Sift through it and see if it gives
>> you any ideas.
>>>
>>> // Generate the Holiday mask so we don't backtest trading
>> or use in
>>> volume calculations
>>> Holiday = 1;
>>> for(i=0; StrExtract(HolidayList,i)!=""; i++){Holiday &=
>> BarDates !=
>>> StrToNum(StrExtract(HolidayList,i));}
>>> Halfday0 = 1;
>>> for(i=0; StrExtract(HalfdayList,i)!=""; i++){Halfday0 &=
>> BarDates !=
>>> StrToNum(StrExtract(HalfdayList,i));}
>>> Halfday = Halfday0 | BarTimes <= 130000;
>>> // Major US equity markets open/close markers
>>> MarketOpen = Holiday AND Halfday AND BarTimes >= 93000 AND
>> BarTimes <=
>>> 160000;
>>> FirstTradeBar = Cross(MarketOpen,.5);
>>> LastTradeBar = Cross(.5,MarketOpen);
>>> // Market volume valid mask
>>> ValidVolBars = MarketOpen AND Halfday0;
>>> // Time of day to place trades mask
>>> EntryTimes = TimeNum() >= TradeBeg AND TimeNum() <= TradeEnd-
>>> TradeEnd2; //time of day to place new trades
>>> EntryTimes &= HalfDay & Holiday;
>>> ExitTimes = TimeNum() >= TradeBeg AND TimeNum() <=
>> TradeEnd; //time of
>>> day to place exits
>>> ExitTimes &= HalfDay & Holiday;
>>> // Go flat at end of day bar
>>> LastDayTradeBar = Cross(TimeNum() >= TradeEnd,.5) |
>> Cross(0.5,HalfDay);
>>>
>>> BR,
>>> Dennis
>>>
>>> On May 20, 2008, at 11:17 AM, sidhartha70 wrote:
>>>
>>>> Herman et al,
>>>>
>>>> any thoughts on this...?
>>>>
>>>> Thanks
>>>>
>>>> --- In amibroker@xxxxxxxxxxxxxxx, "sidhartha70" <sidhartha70@>
>>>> wrote:
>>>>>
>>>>> Herman,
>>>>>
>>>>> thanks for this. very interesting.
>>>>>
>>>>> however, exactly what i'm trying to do is completely reset an
>>>>> indicator at the beginning of each session. the
>> indicator is forming
>>>>> part of an oscillator, so i want to cumulative a value
>> over over each
>>>>> session, and then reset it to zero.
>>>>>
>>>>> is there an easy way of doing that?
>>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------
>>>>
>>>> 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
>>
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG.
>> Version: 8.0.100 / Virus Database: 269.23.21/1456 - Release
>> Date: 5/20/2008 6:45 AM
>>
>
>
> ------------------------------------
>
> 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/