MQL5 Multi variables Array structureMQL5 CTrade Buy() functionMQL5 reversing the array gives errorMQL5 does not allowing the Dynamic Array to store valueArray access is invalid in MQL5 errorMQL5 not taking screenshot while testingNot able to read a file into structure MQL5 MT5MQL5 iterate over structAbout MQL5, how to close a trade and enter a trade

Some Prime Peerage

Is low emotional intelligence associated with right-wing and prejudiced attitudes?

Is there any reason to concentrate on the Thunderous Smite spell after using its effects?

Make 2019 with single digits

Examples of proofs by making reduction to a finite set

Reading double values from a text file

How does a simple logistic regression model achieve a 92% classification accuracy on MNIST?

What officially disallows US presidents from driving?

super and subscripts on stackrel variable

Usage of blank space in trade banner and text-positioning

Is there a tool to measure the "maturity" of a code in Git?

ColorFunction based on array index in ListLinePlot

Which is the current decimal separator?

How do I say "quirky" in German without sounding derogatory?

I was promised a work PC but still awaiting approval 3 months later so using my own laptop - Is it fair to ask employer for laptop insurance?

Can Feather bring back a spell with Jump-Start?

What is the mathematical notation for rounding a given number to the nearest integer?

Planar regular languages

Is using gradient descent for MIP a good idea?

Where is it? - The Google Earth Challenge Ep. 2

Can derivatives be defined as anti-integrals?

Is there any benefit to riders on the front of a paceline?

Why don't airports use arresting gears to recover energy from landing passenger planes?

How to publish superseding results without creating enemies



MQL5 Multi variables Array structure


MQL5 CTrade Buy() functionMQL5 reversing the array gives errorMQL5 does not allowing the Dynamic Array to store valueArray access is invalid in MQL5 errorMQL5 not taking screenshot while testingNot able to read a file into structure MQL5 MT5MQL5 iterate over structAbout MQL5, how to close a trade and enter a trade






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















How to create an Array on MQL5 that can hold 3 variablesand how to fill it and how to call it?
Please see the picture
https://i.imgur.com/VyjmwNW.jpg
[![array][1]][1]



After nicholishen Answer when i try to Initialize array useing Variables i get the follwing error : 'hi' - constant expression required 22.mq5 16 18



void OnStart()

struct MyData string name; double price; int volume; ;
// initializing an array of structs


double hi= 0.01;


MyData arr[] =
"USDJPY", hi, 200,
"USDJPY", 110.100, 300,
"USDJPY", 110.200, 400,
;











share|improve this question


























  • What do you mean when talking about 3 variables? different types of data (ints and doubles)? or something else?

    – Daniel Kniaz
    Mar 28 at 16:35











  • No the same, I'm new and learning and its driving me crazy

    – user2767046
    Mar 28 at 16:44











  • so what is the problem? you can have a two-dimensional array, second dimension must be fixed, first can be dynamic and change. e.g. int array[][3]; then add more elements by using ArrayResize function - it is well documented so please show what you did and why it does not work so that we will try to help you wiht your code.

    – Daniel Kniaz
    Mar 28 at 20:20











  • Daniel thank you for your replay, Just want to understand the array structure in MQL5

    – user2767046
    Mar 29 at 5:44


















0















How to create an Array on MQL5 that can hold 3 variablesand how to fill it and how to call it?
Please see the picture
https://i.imgur.com/VyjmwNW.jpg
[![array][1]][1]



After nicholishen Answer when i try to Initialize array useing Variables i get the follwing error : 'hi' - constant expression required 22.mq5 16 18



void OnStart()

struct MyData string name; double price; int volume; ;
// initializing an array of structs


double hi= 0.01;


MyData arr[] =
"USDJPY", hi, 200,
"USDJPY", 110.100, 300,
"USDJPY", 110.200, 400,
;











share|improve this question


























  • What do you mean when talking about 3 variables? different types of data (ints and doubles)? or something else?

    – Daniel Kniaz
    Mar 28 at 16:35











  • No the same, I'm new and learning and its driving me crazy

    – user2767046
    Mar 28 at 16:44











  • so what is the problem? you can have a two-dimensional array, second dimension must be fixed, first can be dynamic and change. e.g. int array[][3]; then add more elements by using ArrayResize function - it is well documented so please show what you did and why it does not work so that we will try to help you wiht your code.

    – Daniel Kniaz
    Mar 28 at 20:20











  • Daniel thank you for your replay, Just want to understand the array structure in MQL5

    – user2767046
    Mar 29 at 5:44














0












0








0








How to create an Array on MQL5 that can hold 3 variablesand how to fill it and how to call it?
Please see the picture
https://i.imgur.com/VyjmwNW.jpg
[![array][1]][1]



After nicholishen Answer when i try to Initialize array useing Variables i get the follwing error : 'hi' - constant expression required 22.mq5 16 18



void OnStart()

struct MyData string name; double price; int volume; ;
// initializing an array of structs


double hi= 0.01;


MyData arr[] =
"USDJPY", hi, 200,
"USDJPY", 110.100, 300,
"USDJPY", 110.200, 400,
;











share|improve this question
















How to create an Array on MQL5 that can hold 3 variablesand how to fill it and how to call it?
Please see the picture
https://i.imgur.com/VyjmwNW.jpg
[![array][1]][1]



After nicholishen Answer when i try to Initialize array useing Variables i get the follwing error : 'hi' - constant expression required 22.mq5 16 18



void OnStart()

struct MyData string name; double price; int volume; ;
// initializing an array of structs


double hi= 0.01;


MyData arr[] =
"USDJPY", hi, 200,
"USDJPY", 110.100, 300,
"USDJPY", 110.200, 400,
;








mql5






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 31 at 12:22







user2767046

















asked Mar 28 at 11:33









user2767046user2767046

84 bronze badges




84 bronze badges















  • What do you mean when talking about 3 variables? different types of data (ints and doubles)? or something else?

    – Daniel Kniaz
    Mar 28 at 16:35











  • No the same, I'm new and learning and its driving me crazy

    – user2767046
    Mar 28 at 16:44











  • so what is the problem? you can have a two-dimensional array, second dimension must be fixed, first can be dynamic and change. e.g. int array[][3]; then add more elements by using ArrayResize function - it is well documented so please show what you did and why it does not work so that we will try to help you wiht your code.

    – Daniel Kniaz
    Mar 28 at 20:20











  • Daniel thank you for your replay, Just want to understand the array structure in MQL5

    – user2767046
    Mar 29 at 5:44


















  • What do you mean when talking about 3 variables? different types of data (ints and doubles)? or something else?

    – Daniel Kniaz
    Mar 28 at 16:35











  • No the same, I'm new and learning and its driving me crazy

    – user2767046
    Mar 28 at 16:44











  • so what is the problem? you can have a two-dimensional array, second dimension must be fixed, first can be dynamic and change. e.g. int array[][3]; then add more elements by using ArrayResize function - it is well documented so please show what you did and why it does not work so that we will try to help you wiht your code.

    – Daniel Kniaz
    Mar 28 at 20:20











  • Daniel thank you for your replay, Just want to understand the array structure in MQL5

    – user2767046
    Mar 29 at 5:44

















What do you mean when talking about 3 variables? different types of data (ints and doubles)? or something else?

– Daniel Kniaz
Mar 28 at 16:35





What do you mean when talking about 3 variables? different types of data (ints and doubles)? or something else?

– Daniel Kniaz
Mar 28 at 16:35













No the same, I'm new and learning and its driving me crazy

– user2767046
Mar 28 at 16:44





No the same, I'm new and learning and its driving me crazy

– user2767046
Mar 28 at 16:44













so what is the problem? you can have a two-dimensional array, second dimension must be fixed, first can be dynamic and change. e.g. int array[][3]; then add more elements by using ArrayResize function - it is well documented so please show what you did and why it does not work so that we will try to help you wiht your code.

– Daniel Kniaz
Mar 28 at 20:20





so what is the problem? you can have a two-dimensional array, second dimension must be fixed, first can be dynamic and change. e.g. int array[][3]; then add more elements by using ArrayResize function - it is well documented so please show what you did and why it does not work so that we will try to help you wiht your code.

– Daniel Kniaz
Mar 28 at 20:20













Daniel thank you for your replay, Just want to understand the array structure in MQL5

– user2767046
Mar 29 at 5:44






Daniel thank you for your replay, Just want to understand the array structure in MQL5

– user2767046
Mar 29 at 5:44













1 Answer
1






active

oldest

votes


















0
















What I believe you are looking for is an array of structs. A struct is an object that can hold different types of data. Here is a example you can run in your terminal.



void OnStart()

struct MyData string name; double price; int volume; ;
// initializing an array of structs
MyData arr[] =
"USDJPY", 110.000, 200,
"USDJPY", 110.100, 300,
"USDJPY", 110.200, 400,
;
// changing some values
arr[1].name = "EURUSD";
arr[1].price = 1.12;
arr[1].volume = 1000;

for (int i=0; i<ArraySize(arr); i++)
printf(
"Symbol=%s, price=%.3f, vol=%d",
arr[i].name,
arr[i].price,
arr[i].volume
);






share|improve this answer

























  • I got constant expression required when tryeing to Initialize array useing variables?

    – user2767046
    Mar 31 at 12:23











  • When initializing any array, regardless of type, you can only use constants not variables. Why do you tell me what you're trying to do and maybe I can show you a better way.

    – nicholishen
    Mar 31 at 14:31











  • I want to save all open position information into array with unique identifying integer " ticket for example " so i can check the changes in position information

    – user2767046
    Apr 1 at 15:04










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55396573%2fmql5-multi-variables-array-structure%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0
















What I believe you are looking for is an array of structs. A struct is an object that can hold different types of data. Here is a example you can run in your terminal.



void OnStart()

struct MyData string name; double price; int volume; ;
// initializing an array of structs
MyData arr[] =
"USDJPY", 110.000, 200,
"USDJPY", 110.100, 300,
"USDJPY", 110.200, 400,
;
// changing some values
arr[1].name = "EURUSD";
arr[1].price = 1.12;
arr[1].volume = 1000;

for (int i=0; i<ArraySize(arr); i++)
printf(
"Symbol=%s, price=%.3f, vol=%d",
arr[i].name,
arr[i].price,
arr[i].volume
);






share|improve this answer

























  • I got constant expression required when tryeing to Initialize array useing variables?

    – user2767046
    Mar 31 at 12:23











  • When initializing any array, regardless of type, you can only use constants not variables. Why do you tell me what you're trying to do and maybe I can show you a better way.

    – nicholishen
    Mar 31 at 14:31











  • I want to save all open position information into array with unique identifying integer " ticket for example " so i can check the changes in position information

    – user2767046
    Apr 1 at 15:04















0
















What I believe you are looking for is an array of structs. A struct is an object that can hold different types of data. Here is a example you can run in your terminal.



void OnStart()

struct MyData string name; double price; int volume; ;
// initializing an array of structs
MyData arr[] =
"USDJPY", 110.000, 200,
"USDJPY", 110.100, 300,
"USDJPY", 110.200, 400,
;
// changing some values
arr[1].name = "EURUSD";
arr[1].price = 1.12;
arr[1].volume = 1000;

for (int i=0; i<ArraySize(arr); i++)
printf(
"Symbol=%s, price=%.3f, vol=%d",
arr[i].name,
arr[i].price,
arr[i].volume
);






share|improve this answer

























  • I got constant expression required when tryeing to Initialize array useing variables?

    – user2767046
    Mar 31 at 12:23











  • When initializing any array, regardless of type, you can only use constants not variables. Why do you tell me what you're trying to do and maybe I can show you a better way.

    – nicholishen
    Mar 31 at 14:31











  • I want to save all open position information into array with unique identifying integer " ticket for example " so i can check the changes in position information

    – user2767046
    Apr 1 at 15:04













0














0










0









What I believe you are looking for is an array of structs. A struct is an object that can hold different types of data. Here is a example you can run in your terminal.



void OnStart()

struct MyData string name; double price; int volume; ;
// initializing an array of structs
MyData arr[] =
"USDJPY", 110.000, 200,
"USDJPY", 110.100, 300,
"USDJPY", 110.200, 400,
;
// changing some values
arr[1].name = "EURUSD";
arr[1].price = 1.12;
arr[1].volume = 1000;

for (int i=0; i<ArraySize(arr); i++)
printf(
"Symbol=%s, price=%.3f, vol=%d",
arr[i].name,
arr[i].price,
arr[i].volume
);






share|improve this answer













What I believe you are looking for is an array of structs. A struct is an object that can hold different types of data. Here is a example you can run in your terminal.



void OnStart()

struct MyData string name; double price; int volume; ;
// initializing an array of structs
MyData arr[] =
"USDJPY", 110.000, 200,
"USDJPY", 110.100, 300,
"USDJPY", 110.200, 400,
;
// changing some values
arr[1].name = "EURUSD";
arr[1].price = 1.12;
arr[1].volume = 1000;

for (int i=0; i<ArraySize(arr); i++)
printf(
"Symbol=%s, price=%.3f, vol=%d",
arr[i].name,
arr[i].price,
arr[i].volume
);







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 30 at 22:16









nicholishennicholishen

8893 silver badges13 bronze badges




8893 silver badges13 bronze badges















  • I got constant expression required when tryeing to Initialize array useing variables?

    – user2767046
    Mar 31 at 12:23











  • When initializing any array, regardless of type, you can only use constants not variables. Why do you tell me what you're trying to do and maybe I can show you a better way.

    – nicholishen
    Mar 31 at 14:31











  • I want to save all open position information into array with unique identifying integer " ticket for example " so i can check the changes in position information

    – user2767046
    Apr 1 at 15:04

















  • I got constant expression required when tryeing to Initialize array useing variables?

    – user2767046
    Mar 31 at 12:23











  • When initializing any array, regardless of type, you can only use constants not variables. Why do you tell me what you're trying to do and maybe I can show you a better way.

    – nicholishen
    Mar 31 at 14:31











  • I want to save all open position information into array with unique identifying integer " ticket for example " so i can check the changes in position information

    – user2767046
    Apr 1 at 15:04
















I got constant expression required when tryeing to Initialize array useing variables?

– user2767046
Mar 31 at 12:23





I got constant expression required when tryeing to Initialize array useing variables?

– user2767046
Mar 31 at 12:23













When initializing any array, regardless of type, you can only use constants not variables. Why do you tell me what you're trying to do and maybe I can show you a better way.

– nicholishen
Mar 31 at 14:31





When initializing any array, regardless of type, you can only use constants not variables. Why do you tell me what you're trying to do and maybe I can show you a better way.

– nicholishen
Mar 31 at 14:31













I want to save all open position information into array with unique identifying integer " ticket for example " so i can check the changes in position information

– user2767046
Apr 1 at 15:04





I want to save all open position information into array with unique identifying integer " ticket for example " so i can check the changes in position information

– user2767046
Apr 1 at 15:04








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.




















draft saved

draft discarded















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55396573%2fmql5-multi-variables-array-structure%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript