BreakEven with request. solution

 

Hi people, how are you? I hope well. I am develloping an EA, but... I can't put the break-even working, it keeps crashing, I tried somethings, but nothing. 


I don't know the way I have to put the information here, so I am not sharing the BE part, now.

 
Have you used the debugger right before the crash to what are the values that cause the crash?
 
Well, I tried again the code from the scratch and now the main error is.. invalid stops, very weird since I declared all right.
 

“Doesn't work” is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.
     How To Ask Questions The Smart Way. 2004
          When asking about code

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code.
     How To Ask Questions The Smart Way. 2004
          Be precise and informative about your problem

We can't see your broken code.

Fix your broken code.

With the information you've provided — we can only guess. And you haven't provided any useful information for that.

 
William Roeder:

“Doesn't work” is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.
     How To Ask Questions The Smart Way. 2004
          When asking about code

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code.
     How To Ask Questions The Smart Way. 2004
          Be precise and informative about your problem

We can't see your broken code.

Fix your broken code.

With the information you've provided — we can only guess. And you haven't provided any useful information for that.

BEs question is over, the problem now it's about a looping I am trying to create related to string for generate new number for a newer order, can you help me, please?

My code for this part:

Carl Schreiber:
Have you used the debugger right before the crash to what are the values that cause the crash?
void TradesTotais()
{
int history0 = 0;
int history1 = 1;
int history2 = history1++;
int history3 = history2++;
IntegerToString(history0,history1);
IntegerToString(history2);
IntegerToString(history3);
if(PositionsTotal() == 1 && OrdersTotal() <= 1)
{
Print("Histórico: ",history1);

if(PositionsTotal() == 1 && OrdersTotal() == 1)
{
Print("Histórico: ",history2);
if(PositionsTotal() == 1 && history2)
{
Print("Histórico: ",history3);
}
}
}
}

Thanks for you all.

 
  1. Please use the Styler (Ctrl ,) before posting the code here. It will even help you with your code.

  2. the ++ operator is changing the variable it is associated with what you mean would be (I guess):
    int history2 = history1+1;
    But why don't you use simply
    int history2 = 3;
    int history3 = 4;

  3. Do you want positions and orders from the history or actual open and placed ones? The functions are different!
    You can use this list for a kind of keyword search: https://www.mql5.com/en/docs/function_indices. E.g. search for History there with Ctrl f.

  4. Wouldn't do it a simple
    Print("Histórico: ",(PositionsTotal()+OrdersTotal()));
    But these would be the sum of open positiones and pending orders.

  5. You'd better look for sample code in the CodeBase or the Articles the nearly meet your needs and amend this.
    It's a better and faster way to learn MQL5 as you don't step into each pitfall.

Documentation on MQL5: Language Basics / Operations and Expressions
Documentation on MQL5: Language Basics / Operations and Expressions
  • www.mql5.com
Operations and Expressions - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Carl Schreiber:
  1. Please use the Styler (Ctrl ,) before posting the code here. It will even help you with your code.

  2. the ++ operator is changing the variable it is associated with what you mean would be (I guess): But why don't you use simply

  3. Do you want positions and orders from the history or actual open and placed ones? The functions are different!
    You can use this list for a kind of keyword search: https://www.mql5.com/en/docs/function_indices. E.g. search for History there with Ctrl f.

  4. Wouldn't do it a simple
    But these would be the sum of open positiones and pending orders.

  5. You'd better look for sample code in the CodeBase or the Articles the nearly meet your needs and amend this.
    It's a better and faster way to learn MQL5 as you don't step into each pitfall.

Well, I made another way and it's ok now. If new questions pop up I will call you again, ok? Cheers!

 
Friends, I only have right now a question: it's possible to create a structure like MQLTick or MQLRates with the pink color for use in other codes? Making structures created by me as patterns?
 
Carl Schreiber:
  1. Please use the Styler (Ctrl ,) before posting the code here. It will even help you with your code.

  2. the ++ operator is changing the variable it is associated with what you mean would be (I guess): But why don't you use simply

  3. Do you want positions and orders from the history or actual open and placed ones? The functions are different!
    You can use this list for a kind of keyword search: https://www.mql5.com/en/docs/function_indices. E.g. search for History there with Ctrl f.

  4. Wouldn't do it a simple
    But these would be the sum of open positiones and pending orders.

  5. You'd better look for sample code in the CodeBase or the Articles the nearly meet your needs and amend this.
    It's a better and faster way to learn MQL5 as you don't step into each pitfall.

It's very funny, cause I managed to solve the orders count problem using .deal from the result part about MQLTradeResult, but I tried with a new EA the same and... nothing, very strange, the results maintain at 0;

Reason: