NexusFi: Find Your Edge


Home Menu

 





Can you build a strategy to reference another chart window? MC.NET


Discussion in MultiCharts

Updated
    1. trending_up 2,939 views
    2. thumb_up 7 thanks given
    3. group 3 followers
    1. forum 14 posts
    2. attach_file 0 attachments




 
Search this Thread

Can you build a strategy to reference another chart window? MC.NET

  #1 (permalink)
 BrianBacchus 
Las Vegas
 
Experience: Intermediate
Platform: MultiCharts .NET
Trading: CL
Posts: 26 since Oct 2015
Thanks Given: 7
Thanks Received: 37

I know that the MaxBarsBack in .NET for strategies is the same for all data series on the same chart. That's a dumb limitation of MC.NET and I'm trying to get around it.

I want 1 tick data series
10,000 contract bars for Data2
100,000 contract bars for Data3

I want to be able to reference 2500 "bars" back on the 1 tick Data1 without going 2500 bars back on Data3. I'm trying to work around this by rebuilding the bars with tick/vol data, but I could have swore I've seen a method to program a study to reference another study on another chart. Has anyone else ever run across this?

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
Cheap historycal L1 data for stocks
Stocks and ETFs
ZombieSqueeze
Platforms and Indicators
 
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

BrianBacchus,

you can send data across different charts and using Globals would be one way. However it might also be possible to
reduce the required MaxBarsBack and in turn keep everything on one chart. As an example instead of looking 2500 bars back for a certain value, you could keep a list or dictionary of the required values yourself. This could theoretically bring your MaxBarsBack requirement down to one (depending on the code of course).

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #3 (permalink)
 BrianBacchus 
Las Vegas
 
Experience: Intermediate
Platform: MultiCharts .NET
Trading: CL
Posts: 26 since Oct 2015
Thanks Given: 7
Thanks Received: 37



ABCTG View Post
BrianBacchus,

you can send data across different charts and using Globals would be one way. However it might also be possible to
reduce the required MaxBarsBack and in turn keep everything on one chart. As an example instead of looking 2500 bars back for a certain value, you could keep a list or dictionary of the required values yourself. This could theoretically bring your MaxBarsBack requirement down to one (depending on the code of course).

Regards,

ABCTG

Huge thanks! I hadn't considered listing/dictionary so that might be the route I'd go. Researching Globals, at least in the 10 minutes since I've done so (thanks for giving me the right keyword to search!) looks like it might get more messy.

I'm pretty much learning C# as I go from writing scripts in MC .NET so a lot of this stuff is new to me.

Started this thread Reply With Quote
Thanked by:
  #4 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

BrianBacchus,

you are welcome. When you start sending data across charts for strategies you might also run into a few additional problems - for example optimizations might become challenging or you might have to deal with avoiding "to look into the future" i.e. basically accessing data from the other charts that in real time couldn't be available at that moment etc.. In the end handling everything on one chart might be the easier approach, even if it requires a bit of coding to limit the required MaxBarsBack.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #5 (permalink)
 BrianBacchus 
Las Vegas
 
Experience: Intermediate
Platform: MultiCharts .NET
Trading: CL
Posts: 26 since Oct 2015
Thanks Given: 7
Thanks Received: 37

Just FYI, here's something I ran across while I researched this issue. The 2nd item looks interesting as it has the data already inventoried without creating additional lists/dictionaries/arrays:

https://www.multicharts.com/discussion/viewtopic.php?t=45662
There are multiple ways to access data:

1) With the MaxBarsBack constraint
This is the default way, i.e. Bars.Close[1] etc.

2) Without the MaxBarsBack constraint
In this situation you can use the data of the whole data series; i.e. from Bars.FullSymbolData.Close[0] (first bar) to Bars.FullSymbolData.Close[Bars.FullSymbolData.Count] (last bar). See the MultiCharts programming manual, page 22, section 4.2.5 for this.

Started this thread Reply With Quote
Thanked by:
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

BrianBacchus,

yes, this can be useful, but it will depend on what causes the "MaxBarsBack issue" for you. There are a few posts in the MC forum dealing with similar problems and although they are for regular MC, you might still be able to find some helpful ideas:

https://www.multicharts.com/discussion/viewtopic.php?f=1&t=51370

https://www.multicharts.com/discussion/viewtopic.php?f=1&t=50854

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #7 (permalink)
 BrianBacchus 
Las Vegas
 
Experience: Intermediate
Platform: MultiCharts .NET
Trading: CL
Posts: 26 since Oct 2015
Thanks Given: 7
Thanks Received: 37

Also very helpful. I'm trying to use Fisher Transforms on each timeframe/data series. The higher time frames provide filters for the lowest timeframe.

The "BarsBack" for the 2 higher timeframes probably wouldn't be more than 20, but for the tick level it's going to be 2500.

Since the FisherTransform uses its own previous value to calculate present value, I'm thinking I might need to do some sort of "for" loop calling data on that Bars.FullSymbolData.Close to get present value without using the standard Bars.Close[""] structure.

It's either that, or build a dictionary of the last 2500 values of the FisherTransform indicator calculation. This is probably the most efficient since it only calls the FT calculation once per tick. I'm just not too familiar with dictionaries yet so that will require a learning process. Code-wise I'm not sure where to start.

Started this thread Reply With Quote
  #8 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

BrianBacchus,

if you only need the previous value of the Fisher Transformation to compute the new one, you might not require a loop and could just just reference the previous value. However not knowing the code you are having for the Fisher Transformation I can't say for sure.
Apart from that you don't need a dictionary, you could hold the values in an array or a list. Once your array is filled, you would simply overwrite the oldest entry with the new one. This way you only have all the necessary values in your array and this might help the code performance. A list can be handled in a similar fashion or by adding the new value to the back while removing the first entry when you have the desired amount of values stored in the list.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #9 (permalink)
 Arch 
W.Coast, USA.
 
Experience: Intermediate
Platform: Anything
Trading: Emini
Posts: 347 since Jul 2017
Thanks Given: 106
Thanks Received: 381

I had a similar requirement, except with getting bid/ask data from barsofdata on subcharts. MC.NET doesn't provide bid/ask data on subcharts (i.e., subdata series).

This might help you: https://www.multicharts.com/discussion/viewtopic.php?f=19&t=45280

Reply With Quote
  #10 (permalink)
 BrianBacchus 
Las Vegas
 
Experience: Intermediate
Platform: MultiCharts .NET
Trading: CL
Posts: 26 since Oct 2015
Thanks Given: 7
Thanks Received: 37



ABCTG View Post
BrianBacchus,

if you only need the previous value of the Fisher Transformation to compute the new one, you might not require a loop and could just just reference the previous value. However not knowing the code you are having for the Fisher Transformation I can't say for sure.
Apart from that you don't need a dictionary, you could hold the values in an array or a list. Once your array is filled, you would simply overwrite the oldest entry with the new one. This way you only have all the necessary values in your array and this might help the code performance. A list can be handled in a similar fashion or by adding the new value to the back while removing the first entry when you have the desired amount of values stored in the list.

Regards,

ABCTG

Well... I was wrong. The FT actually needs to call back the entire "length" as it searches for the Max and Min values of Bars.Close over that length.

Honestly, I'm running into a wall here because I don't know enough about doing Arrays/lists. In this case I know I need an Array or List that collects the last 2500 values for Bar.Close. I've tried setting this up a few times in different ways but I'm doing it under CalcBar, and it's always biffing out my values to just one. Here's essentially what I'm trying to:

for (i = 0; i <= length; i++){
priceArray[i] = Bars.Close[i]
}

^ This would give me exactly what I want, but it calculates all 2500 values every bar AND it calls 2500 bars back to do so. So it still trips MaxBarsBack.

I've tried doing something like priceList.Add(Bars.Close[0]) but that also just gives me a list with only the very first close value on the chart repeated every single bar. (this was also done under CalcBar).

I'm sure the answer is something incredibly basic but I'm missing it. At this point any code help would be greatly appreciated and I'll happily share the entire finished product once I'm able to fill in this piece.

To restate the problem very simply: I need to be able to record the last 2500 values for Bars.Close without calling 2500 bars back. Some method of recording and appending a list/array as Bars.Close values come in should do it (and even better if it loses the 2501+ values since they're no longer needed).

Started this thread Reply With Quote




Last Updated on June 6, 2018


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts