RightEdge Forums
Main     Home          Members     Calendar     Who's On

Welcome Guest
        


12»»

Weekly strategies Expand / Collapse
Message
Posted 3/1/2010 12:07:38 Post #10993
 

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member
Hi,

I am evaluating your product, and I am so far very impressed. Congratulations to the development team.

I am trying to adapt a certain number of strategies I had developed with Multicharts in EasyLanguage.
I a stuck with a problem related to weekly strategies. I would like my weekly strategies to be calculated on the last day of every week, and not on any other day.
Is there a parameter which I could adjust or an instruction I could include in my code to obtain this result ?

Thanks in advance ,
Regards,

Pierre
Posted 3/1/2010 23:21:51 Post #10995
 

DeveloperDeveloperDeveloperDeveloperDeveloperDeveloperDeveloperDeveloper
Do you want your system to work on weekly or daily bars? If you want weekly bars, just set the Frequency to Weekly in the system properties. If you want to use daily bars but only do trading on Fridays, you can use something like the following in your NewBar() method:

if (Bars.Current.BarStartTime.DayOfWeek == DayOfWeek.Friday)
{
// Your code here...
}

Thanks,
Daniel
Posted 3/2/2010 06:55:30 Post #11001
 

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member
Daniel,

Thank you very much for your quick answer.

Two more questions :
- is it possible to evaluate the strategy on a weekly basis, and still to have some indicators (for instance the volatility) evaluated on a daily basis ? Would something like :
vol = new HistoricalVolatility(Length,220,DailyFreq.Close);
produce correct results inside a weekly based strategy ?

- how can I simulate an order given to the market at the closing of cash market, but based on the bar which is about to close ?
When I simulate an market order, the execution is based on the opening of the market the next day.
In practice, I am trading futures just at the closing of cash equity markets, so this does make sense.

Thanks in advance,

Pierre
Posted 3/2/2010 08:19:28 Post #11003
 

Lead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead Developer
You would create the indicator on the daily frequency and you can access the values on the monthly frequency, so yes.

If you're running in simulation, the default is to convert bars to 4 ticks, one for the high, open, low and close. If you override NewTick, you'll receive the 4 notifications with the last one of the period being the close. In your case, since you want the order to happen on the close, you probably want to submit your market order on the 3rd tick so it is filled on the 4th (closing) tick.

pch (3/2/2010)
Daniel,

Thank you very much for your quick answer.

Two more questions :
- is it possible to evaluate the strategy on a weekly basis, and still to have some indicators (for instance the volatility) evaluated on a daily basis ? Would something like :
vol = new HistoricalVolatility(Length,220,DailyFreq.Close);
produce correct results inside a weekly based strategy ?

- how can I simulate an order given to the market at the closing of cash market, but based on the bar which is about to close ?
When I simulate an market order, the execution is based on the opening of the market the next day.
In practice, I am trading futures just at the closing of cash equity markets, so this does make sense.

Thanks in advance,

Pierre
Posted 3/2/2010 10:06:50 Post #11006
 

DeveloperDeveloperDeveloperDeveloperDeveloperDeveloperDeveloperDeveloper
See also SystemData.EnableTradeOnClose and SystemData.OnBarClosing to be able to get a preview of the close price but still trade on it.

Thanks,
Daniel
Posted 3/2/2010 15:17:00 Post #11008
 

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member
Thanks very much to both of you.

Pierre
Posted 3/8/2010 10:56:53 Post #11089
 

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member
Overriding the NewTick method would not make too much sense for me in this strategy, because it would require me to make a decision to evaluate my signal on the high or the low of a weekly bar, which is not very convenient, nor too compliant with the reality.
A better approach, which would be more realistic, would be to reprocess daily bars and make the decision on the high or low of the last day of the week, but this is much ahead of my competence for now.

What will happen, in terms of program dynamic, if I set the SystemData.EnableTradeOnClose to true, leave the evaluation of the signal in the NewBar() method, and move the order execution in the BarClosing() method ?

Thanks in advance,

Pierre
Posted 3/9/2010 09:30:24 Post #11107
 

Lead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead Developer
See BarClosing event. But yes, this would give you an event before the close of the week.

If you have daily bars, you could setup a multiple frequency system. See the "What's New In This Edition" help topic for a quick sample on creating multiple frequencies.

pch (3/8/2010)
Overriding the NewTick method would not make too much sense for me in this strategy, because it would require me to make a decision to evaluate my signal on the high or the low of a weekly bar, which is not very convenient, nor too compliant with the reality.
A better approach, which would be more realistic, would be to reprocess daily bars and make the decision on the high or low of the last day of the week, but this is much ahead of my competence for now.

What will happen, in terms of program dynamic, if I set the SystemData.EnableTradeOnClose to true, leave the evaluation of the signal in the NewBar() method, and move the order execution in the BarClosing() method ?

Thanks in advance,

Pierre
Posted 3/10/2010 00:59:08 Post #11120
 

DeveloperDeveloperDeveloperDeveloperDeveloperDeveloperDeveloperDeveloper
What will happen, in terms of program dynamic, if I set the SystemData.EnableTradeOnClose to true, leave the evaluation of the signal in the NewBar() method, and move the order execution in the BarClosing() method ?


BarClosing will happen before NewBar is called, so I'm not sure if this would work for you. You probably want to evaluate the signal before making the decision about whether to trade on the close.

One thing to watch out for is that indicators are not yet updated when BarClosing is called. I am probably going to change this, because this makes it complicated to write logic to run in the BarClosing event.

Thanks,
Daniel
Posted 3/10/2010 03:31:42 Post #11124
 

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member
Thank you Daniel.

In my opinion, evaluating the NewBar before executing BarClosing would be more appropriate with the way I am trying to operate.
Thanks again.

Pierre
« Prev Topic | Next Topic »

12»»

Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: billb, young, dplaisted

Permissions Expand / Collapse

All times are GMT -5:00, Time now is 1:04am

2005-2007 © RightEdge Systems