Questions from Beginners MQL5 MT5 MetaTrader 5 - page 283

 
amavladi:

About telepathy and "purely technical" - that's me for Mr.Reshetov: )))

Good luck to you too.

Sometimes it seems that some experienced veterans deliberately silence the right way of thinking - I never would have thought of it ... and how much time is wasted in vain (( that's how you have to sit in 95% of the losers ((((.
 
chipo:
Sometimes it seems that some experienced old-timers are deliberately blocking the right way of thinking - I would never have thought of that... and how much time wasted in vain (( that's how you have to sit in 95% of losing (((().

Well, the idea for price-catching is correct, but the implementation is what is called "upfront". I did it myself, but I quickly gave it up. My aim was to obtain a guaranteed profit of 20-25 points at breakout and if my profit was 22 points, I needed a slider to 20, i.e. I needed to close my order if my profit had decreased from 23 to 20 points in order not to lose the entire profit because of some couple of points. I used a similar loop until I reached the backtests. Then I rewrote the algorithm to give priority to processing such orders and put all other operations on hold. As an intermediate variant, I developed two functions - one for real and another for backtests, so to speak, approximate algorithms. Such tricks are a tactic, not a strategy, but they are important too.

 
elugovoy:

Well, the idea for price-catching is correct, but the implementation is what is called "upfront". I did it myself, but I quickly gave it up. My aim was to obtain a guaranteed profit of 20-25 points at breakout and if my profit was 22 points, I needed a slider to 20, i.e. I needed to close my order if my profit had decreased from 23 to 20 points in order not to lose the entire profit because of some couple of points. I used a similar loop until I reached the backtests. Then I rewrote the algorithm to give priority to processing such orders and put all other operations on hold. As an intermediate variant, I developed two functions - one for reals and another for backtests - so to speak, approximated algorithms. Such methods are already a tactics, not a strategy, but they are important too.

Thank you very much, I have reread all the articles on testing once again, but there is no mention of the difference between demo and real testing, and this is very important. I accidentally tried it on a real terminal and it turned out to be quite different results. Now it means "the tester creates a real price move discretely and displays new quotes only at the next iteration of the whole EA, so I rewrote the code for testing using series of IF statements, where loop statements were before" (from). I'm 57 years old and these codes look like a dense forest, although I've started to understand it a bit lately by tapping what rules - I change the opening lines of orders for setting pending orders - OP_BUY to OP_BUYSTOP and it works fine - a small delay turns out and I can manage this delay ...

I don't understand how I can determine by 2-3 points what should be closed not to lose all profit. I do it manually when scalping

 
chipo:

Thanks a lot, I re-read all the articles on testing, but nowhere is there any indication of this difference in testing demo and real, and it's very important. I accidentally tried it on a real terminal and it turned out to be quite different results. Now it means "the tester creates a real price move discretely and displays new quotes only at the next iteration of the whole EA, so I rewrote the code for testing using series of IF statements, where loop statements were before" (from). I'm 57 years old and these codes look like a dense forest, although I've started to understand it a little by tapping what controls what - I change the opening order lines for setting pending orders - OP_BUY to OP_BUYSTOP and it works fine - I get a slight delay and I can manage this delay ...

Also about the latch I don't understand how to determine at 2-3 points what should be closed without losing all profits, I do it manually when scalping

It's not really the operators as such that are replaced, but the processing logic. For example, if we're talking about a latch, the algorithm would look something like this:

1. basic checks (this includes checking if the context is free for trading, if Expert Advisor is stopped, if opening of orders is allowed, etc.). This will give some stability to the work of the robot, for example OrderSend/Modify/Delete should not be executed and throw errors if the trade context is busy.

2. If you use a latch, I call it a trap, then the processing code should go second. Here the variable is checked (let it be TrapEnabled), if it is set to true, then the corresponding check is performed to drop the profit and close the position. Otherwise it returns to wait for the next tick and triggers start(). Thus, when the trap is activated, it is given the highest priority. All other operations are ignored, i.e. orders are not opened or modified until the trap or profit order is closed.

3. Counting and analyzing open positions, if any. The analysis includes just checking if the trigger threshold is reached (and setting TrapEnabled), as well as calculating the session profit, and other logic, mostly needed to modify or close an order.

4. Checking order opening conditions, and order opening as such (calculating entry point, stops, profit, lot size, etc.). Note: ECN brokers need to open an order with zero TP, SL, and set them after successful opening of an order.

5. Regulation of orders (trailing, closing, modification, overlap, etc.)

6. Displaying of additional information on a chart, something like a dashboard, so that the process of trading would be visible. Let us say, the session profit, number of open orders, whether the trap is working at the moment.

This is approximately the case. The clarifications and details are defined by the specific technical requirements. By the way, note that the pending STOP and LIMIT orders may be opened at a price different from the one you set. You have placed an OP_BUYSTOP order at 1.3500 and the broker accepted it, but when it comes to the opening, you can see that the broker has opened it at 1.3502. Usually, the reason is that the price of 1.3500 was not in the trading stream, i.e. there was a price of 1.3499, then 1.3502, at this price the order is opened.

In general, there are many different details. You need to live a little and get some bumps.

Speaking of the trap. Generally speaking, a broker will not let you set a stop loss of 2-3 pips from the current price and you will have to wait and close at the market price. You define a variable TrapEnabled (you can specify any name, just for reference only) as a bool on a global level (set false by default or in init()), during the analysis of an open position you set it to true, if the profit is at the trigger level (22-23 points). In step 2, you check if (TrapEnabled) ... call the function with trap logic (otherwise, if the trap is not active, the whole algorithm of the start() function is executed until the end). Well, the function with trap logic checks profit falling <= desired price (20 points) and closes at the market price with slippage (TrapEnabled must be reset to false). If the price is still above the minimum close price - return and wait for the next quote. Thus, the order will either close at profit by itself (in this case TrapEnabled should be handled), or it will be closed at profit by the robot.

This is the general point to clarify the algorithm. I hope I made it clear.

 
Thanks a lot, I read it as a poem and reread it over and over again, it's fantastic logic, it turns out better than any grail - you can put any lot and always be in the +, it's like all brilliant even I can not believe it - I even got a little shocked - really beautiful - just a huge thanks ... Please make it an article: I think it will earn you a world ranking of traders ...
 
chipo:
Thanks a lot, I read and reread the poem, but the logic is fantastic, it turns out better than any grail - you can put any lot and always be in the black, it's like all brilliant even I can not believe it - I even got a little crazy really beautiful - just thank you very much ... Please make it an article: I think it will earn you recognition in the world ranking of traders ...

Well, I guess the trader who earns by trading is familiar with such tricks and there is nothing new in it, and there is not much time to write an article... There are a lot of projects and time is running out... If there are any technical questions, there are competent guys, including moderators, so that will not go unanswered. ))) It's not even alchemy, just a little "feature" that absolutely any trading robot can be equipped with. But I've noticed it very rarely, maybe it's not very effective, but in my project the profitability was increased by 10-15% (on different instruments) due to profit loss elimination in such a way. I would also recommend as another "feature" to limit trading by days of the week, i.e. 5 input parameters of bool type, but it is optional and mostly concerns gaps in weekend when there is a "gap" between market close price (on Friday) and market open price (on Monday) and spread may widen. In general, after 20:00 on Friday, I think few people open positions, rather try to close by that time, because no one knows what news will be released over the weekend.

One more thing, in case you haven't been paying attention. Liquid currencies are tied to energy (mainly oil) because there is an agreement between the U.S. and the UAE to settle accounts for oil in USD only, there is the IMF (International Monetary Fund), which controls the strength of the American dollar (look at the DI dollar index). It is the IMF that regulates the strength of the dollar and consequently the price of energy, metals and, well, the stock exchanges and the Forex market. If the DI goes up, oil and gold will go down and vice versa. The same reflection will be in the Forex market.

Why is the standard of living better in America, this with a national debt of about a million per American? All energy calculations are done in USD. Germany, France, and the whole of Europe are converting euros into dollars to buy gas and oil from Russia, and Russia is converting those dollars into the Russian ruble. Europe loses in euros, Russia loses in roubles. Only the dollar wins, and it wins a lot...

All in all, this is closer to a fundamental view than a technical one. But in any case, it should be taken into account.

Good luck.

 
Hi, can anyone tell me where I can find such an indicator, as shown on the screenshot.
Files:
 
Newalligator:
Hi all. Can anyone tell me where I can find such an indicator as shown in the screenshot.
It's a screenshot from your computer. Look at the name of the indicator and that's it :)
 
Can you tell me how to get the numerical value of a synonym (the current currency pair)?
 
Crucian:
Can you tell me how to get the numerical value of a synonym (the current currency pair)?
The sequence number in Market Watch or the current price?
Reason: