Profile Picture

Weekly strategies

Posted By pch 7 Years Ago
Message
pch
Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)
Posted Monday March 01 2010
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 Monday March 01 2010
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
pch
Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)
Posted Tuesday March 02 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 Tuesday March 02 2010
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 Tuesday March 02 2010
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
pch
Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)
Posted Tuesday March 02 2010
Thanks very much to both of you.

Pierre
pch
Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)
Posted Monday March 08 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 Tuesday March 09 2010
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 Wednesday March 10 2010
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
pch
Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)Supreme Being (2,069 reputation)
Posted Wednesday March 10 2010
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


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems