Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 105

 
Andrey Sokolov:

Greetings.

Can you tell me how to specify the condition, so that if the current candle has already been opened by the specified conditions and closed manually, it will not open before the new one?

If the number of the bar at which the last closed order was opened is the same as the number of the bar at which the last closed order was closed, and this number is equal to zero, then ...
 
Artyom Trishkin:
If the bar number on which the last closed order was opened is the same as the bar number on which the last closed order was closed and this number is zero, then ...
kudos and respect
 
Andrey Sokolov:
kudos and respect
You're welcome - the answer is in your own question ;)
 
Artyom Trishkin:
Start by building a template: in the editor, right click in the navigator window on Indicators and select create a folder. Name it something - it will contain exactly your indicators.

Next, also click on this new folder and select New File. An assistant window will open, where you will select the type of program to be created - User Indicator. You will have to go through all the steps of the wizard, add the input parameters, the type of display, etc. You will have to try and figure this out on your own. Once you get to the end, the new indicator template will be created. All you have to do is to fill it with the required code, but this is the next step...

It's hard to decide what's needed when you don't fully know how it's going to be implemented.

The question is, do I need the On Timer function?

I don't need OnChartEvent. I'm not planning anything like that.

As for OnCalculate, which one is more versatile? OnCalculate (...prices)? I'm thinking of choosing it.

 
Andrey Koldorkin:

It's hard to decide what's needed when you don't know exactly how it's going to be implemented.

The question is, do I need the On Timer function?

I don't need OnChartEvent. I'm not planning anything like that.

As for OnCalculate, which one is more versatile? OnCalculate (...prices)? I'm thinking of choosing it.

Are you going to calculate something in the timer? I don't think so.

But the fact that you need OHLC prices - that should give you the right OnCalculate() of the two.
 
Hi, I'm asking for a hint here, as I can't get an answer elsewhere. I am interested in a question: is it possible to replace the locking function without using counter orders? I.e. after a certain amount of points in a step or in a currency pair, an order or a chain of orders (mainly stop orders) stops increasing profit and freezes it before the end of the cycle, by closing hands or general locking, no matter where the market price moves. It should be noted that normal order closing is not suitable! I just need to manipulate the balance and not to change it as in locking, but lots are lots, like extra orders.

If such a code exists, please give me the name of the function or indicate where to find it.
 
paragon67:
Hi, I'm asking for a hint here, as they can't give you a proper answer elsewhere. I am interested in a question: is it possible to replace the locking function without using counter orders? I.e. after a certain amount of points in a step or in a currency pair, an order or a chain of orders (mainly stop orders) stops increasing profit and freezes it before the end of the cycle, by closing by hand or by total locking, no matter where the market price moves. It should be noted that normal order closing is not suitable! I just need to manipulate the balance and not to change it as in locking, but lots are lots, like extra orders.

If this code exists, please give me the name of the function or point out where to find it.
I have to do it myself and to be honest I have no idea how to smear orders. I am currently doing something similar but it will take a long time.
 
Artyom Trishkin:
Are you going to calculate something in the timer? I don't think so.

But the fact that you need OHLC prices - this should give you the right option OnCalculate() of the two.

A template has been created. Where do we go from here?

We need to teach how to draw his line )

 
Andrey Koldorkin:

A template has been created. Where do we go from here?

We need to teach how to draw his line )

So ... show me the pattern. How do you know what's in there?
 

Please advise on a solution to the rounding problem!

I need to get rid of the decimal point without a remainder - rounding and exponentiation do not solve the whole problem - what should I do?

For example it was 1.44430 and I need 144430.

Part of the code - as is

NormalizeDouble(Low[1],Digits)*MathPow(10,(Digits+1)*1-1)

Reason: