Not later, now. Take the time, get the shift (iBarShift.) Put the value in the correct buffer shift. What's the problem?
No, I think you misunderstood. I mean I don't even know how to finish the first step: to plot my external data under the chart.
I need to know how to plot the data under the chart first, and then see if there is any misalignment. If there is, of course I will try iBarShift, but before that, could you tell me (if you know), how to plot my data under the chart? I could not find any plot option in MT4. Thanks in advance!
fyang8: I could not find any plot option in MT4.
|
|
|
Thanks! The examples in Program Properties (#property) don't seem to be very clear.
Do you know how to load external data when writing an indicator?

- docs.mql4.com
fyang8: Do you know how to load external data when writing an indicator?
|
|
|
I'm not a programmer. I couldn't understand 100% of the manual.
Let's say, for each currency pair, I have a separate excel file, named as "concise_COT_USDCAD.csv", "concise_COT_USDJPY.csv", "concise_COT_EURUSD.csv", "concise_COT_GBPUSD.csv" and so on. In each excel file, there are 5 columns, named as "Date", "net_NonComm", "net_Comm", "differential" and "diff_52_Week_Percentile". In MT4, under the chart window, I want to make 2 more separate windows, the first one for the plot of "net_NonComm", "net_Comm" and "differential" and the second one for the plot of "diff_52_Week_Percentile". How should I do it?
fyang8: I'm not a programmer. I couldn't understand 100% of the manual.
| Then there is no common language for us to communicate. You have only three choices: Search for it, learn to code it, or pay (Freelance) someone to code it. We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using SRC) and the nature of your problem. |
| Then there is no common language for us to communicate. You have only three choices: Search for it, learn to code it, or pay (Freelance) someone to code it. We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using SRC) and the nature of your problem. |
The answers to your questions, while they may appear simple, are actually detailed and lengthy.
It is unlikely that a contributor will have the time to formulate a single post to take you through it all step-by-step.
I'll give you the nuts and bolts:
First, you need to learn the file functions (as linked above by whroeder1).
You'll open the csv file and read the contents. There are examples in the help files about doing this.
You then need to get an understanding of how custom indicators are written. The best way to do this is probably take a look at the code of some of the default indicators included with the platform. A good starting point would be to forget about reading from the csv file and just create an indicator that plots a line in a subwindow with some value assigned to it (like volume). Once you can do that, you can move on to working with the data from the csv file.
Essentially, your indicator will need to loop through all the bars on the chart and assign the value you read from your csv file to the appropriate index of your new indicator's buffer. The way you align the data from your csv file to the correct bar index is by using the function iBarShift().
You also need to remember to close the file when you're done with it.
I will say this is probably not the best "beginners project", so it may take you some time to sort out; it is possibly not a weekend job for a beginner in MQL...
Here is some sample code that would be useful: https://docs.mql4.com/files/filereaddatetime
Good luck!

- docs.mql4.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi! I have some COT data that I want to plot under the main price window as an indicator. The COT data are external data, i.e. independent of the prices. So one can not write it like a traditional indicator calculated from the prices. Since I have all the data needed, I don't need to do any calculation. I only need to convert the date and time so that it aligns with the price chart. I will figure out how to do it later. Now, if we ignore the alignment, what I want to ask is how could I plot the data under the price chart? Thanks!