Thank you for your appreciation. I learned how to program in this forum. I publish my work because it disciplines. I use my descriptions as clues, because I very quickly forget what and how I wrote.
I apologize for my coding style, but it was intended for myself. And was published as a side effect.
Unfortunately, it is impossible to assess the popularity of published works. If someone uses them, then a very narrow circle of users.
Increase the number of users - there is no such goal.
I can't get the data, here I run a script and as I understand the data is now stored somewhere in the terminal:
#include <fxsaber\TradeTransactions\ResourceData.mqh> // https://www.mql5.com/en/code/22166//+------------------------------------------------------------------+//| Script programme start function|//+------------------------------------------------------------------+voidOnStart()
{
const RESOURCEDATA<int>ResourceINT("::int"); // Resource for exchanging ints. const - as a proof that nothing is written to the class object int ArrayINT[]={1,2,3};
ResourceINT=ArrayINT; // The resource stores an array. int ArrayINT2[];
ResourceINT.Get(ArrayINT2); // Read data from the resource.ArrayPrint(ArrayINT2); // Withdrawn: 1 2 3 5 1 2 3
}
//+------------------------------------------------------------------+
here I run another script to get the data that was saved when I ran the first script, but the data is not displayed:
#include <fxsaber\TradeTransactions\ResourceData.mqh> // https://www.mql5.com/en/code/22166//+------------------------------------------------------------------+//| Script programme start function|//+------------------------------------------------------------------+voidOnStart()
{
//---// This is the full name of the resource to be accessed from another programme//const string NameOut=StringSubstr(MQLInfoString(MQL_PROGRAM_PATH),StringLen(TerminalInfoString(TERMINAL_PATH))+5)+"::Ticks"; conststring NameOut=StringSubstr(MQLInfoString(MQL_PROGRAM_PATH),StringLen(TerminalInfoString(TERMINAL_PATH))+5,9)+"Test_Keep_Info.ex5::Ticks";
Print(NameOut); // Print the full name of the resource.const RESOURCEDATA<int>Resource(NameOut); // Resource for accessing data (read-only) from another programmeint ArrayINT2[];
Resource.Get(ArrayINT2); // Read data from the resource.ArrayPrint(ArrayINT2); // Withdrawn:
}
//+------------------------------------------------------------------+
I added static, but it still doesn't work. Can you correct what is wrong there?
Update ResourceData.mqh and try these indicators
// Sending data#property indicator_chart_window#property indicator_plots0#include <fxsaber\TradeTransactions\ResourceData.mqh> // https://www.mql5.com/en/code/22166#include <GlobalVariables.mqh> // https://www.mql5.com/ru/forum/189649#comment_4854618const RESOURCEDATA<MqlTick> Resource("::" + __FILE__); // Resource for data transfer (ticks)voidOnInit()
{
_GlobalVariableSet("ResourceName", Resource.GetFullName()); // Write the full name of the resource to the global variable (read-only)
}
voidOnDeinit( constint )
{
_GlobalVariableDel("ResourceName");
}
intOnCalculate( constint, constint, constint, constdouble &[] )
{
MqlTick Ticks[];
CopyTicks(_Symbol, Ticks, COPY_TICKS_ALL, 0, 5); // Generated data
Resource = Ticks; // Recorded the datareturn(0);
}
// Data retrieval#property indicator_chart_window#property indicator_plots0#include <fxsaber\TradeTransactions\ResourceData.mqh> // https://www.mql5.com/en/code/22166#include <GlobalVariables.mqh> // https://www.mql5.com/ru/forum/189649#comment_4854618intOnCalculate( constint, constint, constint, constdouble &[] )
{
staticconst RESOURCEDATA<MqlTick> Resource(_GlobalVariableGet<string>("ResourceName")); // Created a resource based on the full name passed in the global variableMqlTick Ticks[];
Resource.Get(Ticks); // Read data from the resource.ArrayPrint(Ticks); // Print the obtained datareturn(0);
}
Thanks, I got something, now I will take it apart to see how it works. Can you please correct the warnings in GlobalVariables.mqh? My knowledge ended at Res=-1, but it showed an error there. And I don't know how to remove the OnStart() warning either.
Thank you for your appreciation. I learned how to program in this forum. I publish my work because it disciplines. I use my descriptions as clues, because I very quickly forget what and how I wrote.
I apologize for my coding style, but it was intended for myself. And was published as a side effect.
Unfortunately, it is impossible to assess the popularity of published works. If someone uses them, then a very narrow circle of users.
Increase the number of users - there is no such goal.
I can't get the data, here I run a script and as I understand the data is now stored somewhere in the terminal:
here I run another script to get the data that was saved when I ran the first script, but the data is not displayed:
Can you correct where the error is?
I can't get the data, here I am running a script and as I understand it, the data is now stored somewhere in the terminal
Data is destroyed as soon as its owner (who wrote it) stops working. If this is not done, the Terminal's memory will quickly become cluttered.
Start the data master as an advisor/indicator. As long as it lives, its data will be available to others.
Data is destroyed as soon as its owner (who wrote it) stops working. If this is not done, the memory of the Terminal will quickly become cluttered.
Start the data master as an advisor/indicator. As long as it lives, its data will be available to others.
It didn't work on indicators either. I think something is wrong with the path.
It didn't work on the indicators either. I think something is wrong with the path.
You create a resource in each OnCalculate and kill it when the function is finished.
You should make the object static. This is the basics of OOP.
You create a resource in each OnCalculate and kill it when the function completes.
You should make the object static. This is the basics of OOP.
I added static, but it still doesn't work. Can you correct what is wrong there?
I added static, but it still doesn't work. Can you correct what is wrong there?
Update ResourceData.mqh and try these indicators
Update ResourceData.mqh and try these indicators
Thanks, I got something, now I will take it apart to see how it works.
Can you please correct the warnings in GlobalVariables.mqh? My knowledge ended at Res=-1, but it showed an error there. And I don't know how to remove the OnStart() warning either.
Can you please correct the warnings in GlobalVariables.mqh?
Thank you!