-
(int j = 0; j < OrdersTotal(); j++) {
Do not post code that will not even compile.
-
OrderOpenPriceBuyArray[OrderOpenPrice()];
This is nonsense. You use an int to index into an array. You store a double (a price) into the array.
-
double OrderOpenPriceBuyArray[10]; // datetime LastTimeBuy; //LastBuyOrderTime int count = 0; for(int j = 0; j < OrdersTotal(); j++) if( OrderSelect(j, SELECT_BY_POS) && OrderType() == OP_BUY && OrderSymbol() == Symbol() ){ OrderOpenPriceBuyArray[count] = OrderOpenPrice(); ++count; }
-
Do not post code that will not even compile.
-
This is nonsense. You use an int to index into an array. You store a double (a price) into the array.
Thanks for your input @WilliamRoeder. However it does not save the latest orderopenprice into the array. What is wrong with this new piece of code?
int count = 0; double OrderOpenPriceBuyArray[10]; for(double n = 0; n < OrdersTotal(); n++){ if(OrderSelect(n,SELECT_BY_POS) && OrderType() == OP_BUY && OrderSymbol() == Symbol() ){ OrderOpenPriceBuyArray[count] = OrderOpenPrice(); ++count; } }
- Your posted code (#2) and mine are identical.
- It does not save the latest. It saves all which include the latest.
- There is nothing wrong.
- Your posted code (#2) and mine are identical.
- It does not save the latest. It saves all which include the latest.
- There is nothing wrong.
@WilliamRoeder I understand now that array's save data with the latest data being the last element but I don't know how I can access that last element. Could you point me in the right direction please?
- Rahul Shaji Parmeshwar #: but I don't know how I can access that last element.
You know the array name. You know the array size. If you don't know how, step away from the computer and hire someone.
If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.
-
Don't double post! You already had this thread open.
General rules and best pratices of the Forum. - General - MQL5 programming forum (2017)
I have deleted your other topic.
-
You know the array name. You know the array size. If you don't know how, step away from the computer and hire someone.
If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.
-
Don't double post! You already had this thread open.
General rules and best pratices of the Forum. - General - MQL5 programming forum (2017)
@WilliamRoeder Why are you being so aggressive? I only wanted to educate myself and not get violated by members in this forum! And my question still stands unanswered!
@WilliamRoeder Why are you being so aggressive? I only wanted to educate myself and not get violated by members in this forum! And my question still stands unanswered!
-
You know the array name. You know the array size. If you don't know how, step away from the computer and hire someone.
If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.
-
Don't double post! You already had this thread open.
General rules and best pratices of the Forum. - General - MQL5 programming forum (2017)
I've modified the code now and it still doesn't seem to be working.
double OrderOpenPriceBuyArray[]; double OrderOpenPriceNewBuy = 0; ArraySetAsSeries(OrderOpenPriceBuyArray,True); for(double n = 0; n < OrdersTotal(); n++){ if(OrderSelect(n,SELECT_BY_POS) && OrderType() == OP_BUY && OrderSymbol() == Symbol() ){ if(OrderOpenPrice() != OrderOpenPriceBuyArray[count]){ OrderOpenPriceBuyArray[count] = OrderOpenPrice(); ++count; }} } for(double p =0; p > ArraySize(OrderOpenPriceBuyArray); p++){ OrderOpenPriceNewBuy = p; }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
How would I save the order open price for all open orders and save it into an array which updates every time I add another order?
My code is below.