Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 97
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Type, int or datetime
I once made a function that outputs messages to an empty indicator window. You can adjust the colours of the displayed lines. It's already debugged. I can share it if you need it.
I will gladly look at your code Artem. For testing print, not the most convenient option...
r772ra:
What's this?
Type, int or datetime
I rewrote the whole mess and it came out like this:
For some reason, even when the orders are closed and the last order closing time should not be zero.
We got it in the comment all the time:
Время закрытия последнего открытого ордера = 0
That is why my code does not work further, because this function does not work.
So I rewrote the whole mess and it came out like this:
For some reason even when the orders are closed and the last order closing time should be correspondingly not zero.
I was able to get it in my comment all the time:
That is why nothing works according to my code, because this function does not let me in.
This EA considers pending orders in your code. Well, it will look through the open orders accordingly. Naturally, it will return zero close time.
If you want to view the closed orders, you have to view them in the list of closed orders:
и
But... we need to make two functions - one is looking for open orders and the other is looking for closed orders.
It also takes your pending orders into account. And accordingly it looks through the open orders. Naturally, it will return zero close time.
To view the closed orders, you have to view them in the list of the closed ones:
и
But... we have to make two functions - one is looking for open orders and the other is looking for closed orders.
Thank you, Artyom. Exactly... What's next is a question of code optimisation. There are questions on code structure, but it will have to be written on a fresh head.
I will gladly look at your code, Artem. For testing the print, it is not the most convenient variant...
Here's an EA to test the function. It contains the function itself and its call. Before calling it, you have to prepare a message, which can be up to four lines. The length of each line, if I remember correctly, should not exceed 64 characters. That's why I've split one message into several lines. Each line of one message can be output in a different colour. It's kind of clear in the code there - first we prepare message lines, then we call the function. I haven't commented much there - I wrote it in one go long ago. Now I have already forgotten what is there for. If I have any questions, I'll remember, but I remember only necessary things now.
And a turkey:
That's the way it is... I hope you'll figure it out.
Of course, you can make an underlay instead of outputting it to the main chart, but I am too lazy to do it... :)
Here's an EA to test the function. It contains the function itself and its call. Before calling it, you have to prepare a message, which can be up to four lines. The length of each line, if I remember correctly, should not exceed 64 characters. That's why I've split one message into several lines. Each line of one message can be output in a different colour. It's kind of clear in the code there - first we prepare message lines, then we call the function. I haven't commented much there - I wrote it in one go long ago. Now I have already forgotten what is there for. If I have any questions, I'll remember, but I remember only necessary things now.
And a turkey:
That's the way it is... I hope you'll figure it out.
Of course, you can make an underlay instead of outputting it to the main chart, but I am too lazy to do it... :)
Good people! I've written an EA, everything seems to be working fine in real life. But I check it on the tester - it glitches. The gist of it is as follows. The Expert Advisor should open orders by horizontal lines drawn on the chart. In the tester, it opens them at various levels all the time, as if a lot of lines have been set, though there are none! Can you explain what's wrong?
A part of the code responsible for lines:
int New_gorizont()
{
int tip_o_buy;
int tip_o_sell;
int obj_total=ObjectsTotal();
// if no new lines, exit
if(obj_total==0)
return;
// if(there are...
if(obj_total!=0)
string name=ObjectName(0);
double pr=NormalizeDouble(ObjectGet(name,1),Digits);
ObjectDelete(name); // delete and set again
if(pr>Bid+(Stop_level+1)*Point) // determine the order type
{
tip_o_sell=OP_SELLLIMIT;
tip_o_buy=OP_BUYSTOP;
}
if(pr<Bid-(Stop_level+1)*Point)
{
tip_o_sell=OP_SELLSTOP;
tip_o_buy=OP_BUYLIMIT;
}
// set orders
OrderSend(Symb,tip_o_sell,Value,pr,3,pr+StopLoss*Point,pr-TakeProfit*Point, "Order set");
Prov_oshibok();
................................
}
In other words, obj_total==0 and that's it. But it sets and sets everything to infinity for some reason.
Good people! I have written an EA, everything seems to be working fine in real life, all is normal. But I check it on the tester and it glitches.
I do not believe it, this EA cannot work either on the real site or in the tester.