NexusFi: Find Your Edge


Home Menu

 





DataLoader- incorrect cumulative values for other symbols


Discussion in MultiCharts

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




 
Search this Thread

DataLoader- incorrect cumulative values for other symbols

  #1 (permalink)
dillip91
Cuttack,India
 
Posts: 3 since Jan 2020
Thanks Given: 0
Thanks Received: 2

I am using DataLoader functionality to extract cumulative bid/ask in MC .NET 12 version.
When I put the indicator on a chart and check the cumulative bid/ask values for same symbol, it works perfectly - absolute no issue.
But when I try to extract cumulative values for any other symbol it works only immediately after compiling. But after 5 minutes, they don't update correctly.
In this example I put the indicator on HDFCBANK chart and extract Bid values for same HDFCBANK and RELIANCE. HDFCBANK Bid value is correct and RELIANCE bid is Incorrect.



Code:
using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
using System.Threading;
using System.Collections.Generic;

namespace PowerLanguage.Indicator
{
public class DillipC_Ind : IndicatorObject
{
public DillipC_Ind(object _ctx):base(_ctx){}
private IPlotObject plot1;
private IPlotObject plot2;
private IPlotObject plot3;
private IPlotObjectStr plot_s;
private IPlotObjectStr plot_s1;
private Dictionary<int, BarPriceLevels> m_FootPrintBars;

AutoResetEvent m_Event;
IDataLoaderResult iRes;

protected override void Create()
{
m_Event = new AutoResetEvent(true);
m_FootPrintBars = new Dictionary<int, BarPriceLevels>();
}

protected override void StartCalc()
{
m_FootPrintBars.Clear();
InstrumentDataRequest Req = Bars.Request;
Resolution _res1 = Resolution.CreateCumulativeDelta(EResolution.Second,30,CumulativeDeltaChartType.ASK_TRADE_BID_TRADE,true);
Req.Resolution = _res1;
Req.Subscribe2RT = true;
Req.QuoteField = RequestQuoteField.Bid;

Req.Symbol = "RELIANCE";
iRes = DataLoader.BeginLoadData(Req, _Result, m_Event);
Req.Symbol = "HDFCBANK";
iRes = DataLoader.BeginLoadData(Req, _Result, m_Event);

//m_Event.WaitOne();
//DataLoader.EndLoadData(iRes);
}
protected override void CalcBar()
{
}

protected void _Result(IDataLoaderResult _res)
{

AutoResetEvent _are = (AutoResetEvent)_res.State;


if (_res.IsCompleted)
{
if (_res.Event == DataLoadedEvent.RTNewBar)
{
if (_res.RTData2 != null)
{
Output.WriteLine("{0}: {1}",_res.Request.Symbol, _res.RTData2.Value.Bar.Close);
}
_are.Set();
}
}
}
}
}

Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
REcommedations for programming help
Sierra Chart
Cheap historycal L1 data for stocks
Stocks and ETFs
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #2 (permalink)
thoughtful
Klamath Falls OR
 
Posts: 60 since Apr 2020
Thanks Given: 21
Thanks Received: 80

That's odd- shouldn't the editor's output window show the same value as the chart?

Sorry I'm probably not much help here... I didn't look through your code... but just thought I'd mention a few things:

1) Be advised, when the stock market is closed, your data provider might send random bid/ask data, and MultiCharts may plot that random bid/ask data. But when stock market is open then the bid/ask data will be correct.

2) Check at the beginning of the chart (scroll all the way to the left), and make sure the first plot values of your indicator are correct, ... I mention this because I found a very strange bug in MultiCharts.NET whereby it sometimes plots an incorrect indicator value for the very first plot, but then afterward it's correct. This is why I use the EasyLanguage version LOL, because after I found that bug I won't touch the .NET version with a '10-foot pole'.

3) Do both the editor output and chart have the same MaxBarsBack setting? If not, then that affects what bar the indicator first starts plotting on.

Reply With Quote
  #3 (permalink)
dillip91
Cuttack,India
 
Posts: 3 since Jan 2020
Thanks Given: 0
Thanks Received: 2



thoughtful View Post
That's odd- shouldn't the editor's output window show the same value as the chart?

Sorry I'm probably not much help here... I didn't look through your code... but just thought I'd mention a few things:

1) Be advised, when the stock market is closed, your data provider might send random bid/ask data, and MultiCharts may plot that random bid/ask data. But when stock market is open then the bid/ask data will be correct.

2) Check at the beginning of the chart (scroll all the way to the left), and make sure the first plot values of your indicator are correct, ... I mention this because I found a very strange bug in MultiCharts.NET whereby it sometimes plots an incorrect indicator value for the very first plot, but then afterward it's correct. This is why I use the EasyLanguage version LOL, because after I found that bug I won't touch the .NET version with a '10-foot pole'.

3) Do both the editor output and chart have the same MaxBarsBack setting? If not, then that affects what bar the indicator first starts plotting on.

Editor output is showing correct value if I put the indicator on same chart that I am calculating.
But if I calculate a different symbol by using Reqest.Symbol = "SymbolXYZ" it is incorrect.
Basically my requirement is to track the difference between bid/ask for 100 stocks and export them to google spreadsheet to see which stock gained most bids/asks - say in last 15 minutes.

1) I am testing only in market hours.
2) In my case its just opposite. When I press compile button, the editor output shows correct value for other symbols also. But afterwards they update incorrectly. I think EasyLanguage don't support DataLoader syntax.

This is how my final product looks:

Reply With Quote




Last Updated on July 10, 2020


© 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