[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 805

 
Hello! Please help! There is a function that returns at every tick the OrderCloseTime value of the last closed position! How can I match this value with the previous OrderCloseTime value, and if it is greater - do some follow up. Thank you in advance!
 
dimon74:
Hello! Please help! There is a function that returns at every tick the OrderCloseTime value of the last closed position! How can I match this value with the previous OrderCloseTime value, and if it is greater - do some follow up. Thank you in advance!
What do you mean by previous? Do you want to compare the later time with the earlier one? Obviously the newer one will always be larger than the older one!
 
Techno:
What do you mean by earlier? Do you want to compare a later time with an earlier one? Obviously, the newer one will always be bigger than the older one!
Yes. But how can I do some follow-up based on this comparison?
 
dimon74:
Yes. But how can I do some follow-up based on this comparison?
Do you realise that the condition (if yesterday is past and today is present) is meaningless? since the same thing will always come back.
 
PapaYozh:

It's hard to tell what you have there. Personally, I do not see that "The Buy position closed out of the blue at TakeProfit level of an already closed Sell position". The Sell position under which the arrow is drawn does not seem to contain any dashes.

You don't use OrderCloseBy() in your code?

It's strange that you can't see it. Ok - I've corrected the image:


1 - this is position with ticket 88

2 - pending SellStop with ticket 89

3 and 4 are Sell positions

3.t and 4.t - these are lines that indicate levels of Takei of already closed Sell 3 and 4 positions

3.1 and 4.1 - closing points of positions 3 and 4, and Sell 3 position closed with a loss

1.1 - this is the point of closing the Buy position with Ticket 88 - there is a turquoise vertical line and horizontal Bid price level line,
that just crosses the red line 3.t - the point where Take was closed Sell 3 position...

I don't use OrderCloseBy(), although I initially had a thought...

The idea is this: when a series of losing positions is closed, the possibility of opening a new position is checked, and if there is a certain amount of money left,
, the stop is removed from the last losing position (it can be seen in the picture - the blue line below the Buy position), and a pending order is placed.
When a pending trade is converted into a market trade, the tickets of these two positions (Buy (ticket 88) and Sell (ticket 89)) are memorized and further they are "managed" already as an aggregate position
and are closed by the aggregate profit (loss). In this case trading in Buy is prohibited until these two positions are closed, while trading in Sell is allowed in any case.

And here is where the funny thing happens - the Buy position closes by itself in a way that is not specified in the code... I have no idea how... Immediately after that a whole bunch of errors appear in the log at
- they appear at every tick. Oh man... closed it already... if memory serves me correctly - error 5048... wrong ticket for OrderClose()
Something like that... And then another error of order modification - an unknown ticket #88 is also written...

Looking for it for the third day...

 
dimon74:
Hello! Please help! There is a function that returns at every tick the OrderCloseTime value of the last closed position! How can I match this value with the previous OrderCloseTime value, and if it is greater - do some follow up. Thank you in advance!
In this condition, you will always return the same value. This will be the closing time of the last closed position. As soon as a new position opens and then closes,
that's when your function will start returning a different value.

Obviously, you need also the time of last but one position to be closed, so you can compare something with something. Or, each time you need to store the time returned by your function in some datetime or int variable, and as soon as the new value is different from the previous value returned by your function - this will be a signal to
"... perform some follow-up action...".
 
PapaYozh:

I suggest you read the description of the OrderSelect() function carefully.

The parameter pool is ignored if the order is selected by ticket number

Holy shit!!! Semyon Semyonych!!!

Damn, I always have the terminal help in front of me! Killed three nights on the simplest!!! And help (in this exact place) never looked... :)

Rightly said Matroskin: "Sharik, you're a fool...". That's how I turned into Sharik in three nights... :)

Thank you very much! I got my nose poked in a decent place and I'm overjoyed and grateful... :) Really - thank you...
Uh-uh-uh-uh... r-r-r-r-r-r-i-t-i-t-i-t!!! Let's get a move on finally... :)

 
artmedia70:
In this condition you will always have the same value returned. This will be the closing time of the last closed position. As soon as a new position opens and then closes,
only then will your function begin to return a different value.

Obviously, you need also the time of last but one position to be closed, so you can compare something with something. Or, each time you need to store the time returned by your function in some datetime or int variable, and as soon as the new value is different from the previous value returned by your function - this will be a signal to
"... perform some follow-up action...".
Yes. I understand the logic, but is it possible to implement it in code and if so, how?
 
Dersu: Hello forum users.

My grandparents told me it's Honeymoon Day. Happy holiday, everyone.

And I'm with my... Drknn says it's possible to process indicator readings.

Is it possible to sum A / D for a given period and the same amount OBV, and then divide them between themselves (OBV in the numerator)

The denominator is A/D + coefficient with output to the settings.

Zero in the middle, borders are floating.

Sum-NO TOTAL. Each movement by absolute value.

I will show you a reversal of the EUR.

We write an indicator with a single buffer. First we read one indicator and set it into a variable. Then we take the reading of another one and also put it into a variable. Then we sum up both readings, divide them in two and put the result into the indicator buffer. It's as simple as that. I don't see what the problem is. In ignorance of the language, well, then make a separate branch in which they write, they need turkey - ready to pay for his production. The terms of reference is right here. That's it...

The problem with the money? Read a primer and program it yourself. Or option number two - in the same branch letters saying, are there willing to work for free - the idea - just super, tested five years - works without reservation - here's the account number, here's your investment password - have a look - sick of working manually - I want an autopilot. I want autopilot - full stop!

 

THANK YOU for your attention, drknn.

I've been thinking in my spare time - my second idea is a bit damp.

The first idea was more effective - but you can't do that.

And the second is one of the ways out of the situation.

I'll think about it some more.

Reason: