Profile Picture

When i must start my MACD calculation?

Posted By silvermoot 8 Years Ago
Message
Posted Tuesday September 01 2009
Hi, i am using a strategy with the MACD indicator and i am not sure if i understand well when i should start its calculation...

I am using the MACD(12,26) combined with a EMA(9) of this MACD (the signal)
When i dowload an historical data based on 1min interval for the last day, i compare the
curve to yahoo's MACD curve and all match.I want my macd graph (plotted real time in my strategy) to be equivalent to the history graph with a macd (when i compare at the end of the day).

Basically, in this case, to see the first 2 points of the MACD and its signal plotted on the graph, i would need to get 26 previous periods of data (at this time the MACD is ready), and i need for the signal 9 periods of the MACD....
So i need to calculate 26+9=35 bars before being able to evaluate my MACD with the signal.

Here is my actual question : Do you guys would start 35 bars before 9h30?
If so, do you get the last 35 bars from pre-market (starts at 8h55) or from last
valid trading hours (3h25pm to 4pm)?

Thank you!
Posted Tuesday September 01 2009
You need to set the live lead bars to 35 if you want the system to load those bars. Otherwise, it will just start with the live data, so if you started the system at 9:30 it would wait for 35 live bars to come in before there would be a value for the MACD, which would likely prevent it from trading before then.

If you do set the live lead bars to 35, it will load the most recent 35 bars from your data store. If you have pre-market data in your data store it will load those, if the last bar is at yesterday's close, it will load the bars ending with that.

Thanks,
Daniel
Posted Tuesday September 01 2009
Thank you for the reply, could you tell me where is the live lead bar setting?
Posted Tuesday September 01 2009
Sorry i found it...propertie window Tongue
Posted Tuesday September 01 2009
I can see that the NewBar() method is called during the lead bar period...what is the purpose of the lead bar attribute if i have to handle it manually in NewBar()...
I was expecting that if i set lead bars to 35, i get the first NewBar() call at the 36nth bar...
Posted Tuesday September 01 2009
During the lead bar period, bar (or tick) data is processed but no trading occurs. You won't be able to open a position during this period. However, you may have data processing logic in your NewBar method in addition to trading logic. So we call NewBar during this period. You can check the SystemData.InLeadBars property to determine if you are in the lead bars or not.

Thanks,
Daniel
Posted Wednesday September 02 2009
Ok, thank you


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems