What to feed to the input of the neural network? Your ideas... - page 84

 

Asked Alice

Optimise the code: find ways to optimise the code, for example by simplifying calculations or using more efficient algorithms.

To optimise the presented EA code, several directions can be considered:

1. Simplification and optimisation of calculations

  • Minimisation of calculations in the OnTick function : some calculations, for example, obtaining indicator values or calculating trade parameters, can be performed less frequently than at each tick. For example, if indicator values do not change at every tick, you can cache their values and update them only when necessary.

  • Using more efficient algorithms for calculating trade parameters: for example, instead of sequential search of all positions to calculate the total profit, you can use more efficient data structures or algorithms.

2 Optimising memory usage

  • Reduce the number of variables used: check if you can reduce the number of variables used in the code. For example, some variables can be merged or removed if they are only used in a limited context.

  • Using more compact data types: where possible, use more compact data types, e.g. int instead of double, if it does not affect the accuracy of calculations.

3 Optimise work with objects and indicators

  • Reduce the number of references to indicators: if possible, reduce the number of references to the functions of getting indicator values. For example, you can cache indicator values for a certain period and use them until the next update.

  • Optimisation of work with graphical objects: if a large number of graphical objects are used in the code, check if their creation and updating can be optimised. For example, you can group operations with objects or use more efficient algorithms to place them on the graph.

4. Improve code readability and structure

  • Break code into functions: divide code into smaller functions with clear names and purpose. This will improve code readability and make it easier to debug and modify.

  • Use constants and enumerations:use constants or enumerations instead of hard-coded values. This will make the code more readable and make it easier to modify in the future.

5. Optimising error and exception handling

  • Add error checks: make sure that your code contains checks for possible errors and exceptional situations. For example, check the return values of functions and handle errors accordingly.

  • Using try-catch blocks : where possible, use try-catch blocks to handle exceptions. This will allow you to handle errors more flexibly and prevent EA crashes.

Example of optimising the OnTick function

void OnTick() { static datetime last_tick_time = 0; datetime current_time = TimeCurrent(); if (current_time == last_tick_time) { return; // If the time has not changed, exit the function } last_tick_time = current_time; // This is where the main logic of the Expert Advisor // ... is executed. }

This example adds a check for time change. If the time has not changed, the OnTick function is immediately terminated, which avoids unnecessary calculations during frequent ticks.

The time always changes on every tick, why does it offer such a variant, maybe it has its own concept of time?
 
Ivan Butko #:









It's a handbook. Three different people trade according to one subjective-analytical system with patterns and scenarios of behaviour.

No grids, no martins, no mashes, no standard indicators.

Purely trained by eye on the chart, trained on the context (when you take into account the totality of factors). And there are many of them.


It all works, but not everyone can do it.

I have a hard time with semi-automatic systems, where I have to think with my head, I am too used to formalisations, digging into Expert Advisors.


But there are working systems and this is the motivation - to make NS/II/machine understand the nuances of working with probability theory, using both short stops in time, not rushing to close, and the right time to stay out of the market and wait for ideal conditions.

I know this ts, on breaking the structure, something like the old sniper Pavel Dmitriev.somewhere I have an indyuk with all the logic, the hands do not come to make a robot, as I know that this is purely manual ts, I once traded on it by hand and quite successfully.
 
Ivan Butko #:
I have a hard time with semi-automatic systems, where you have to think with your head, I am too used to formalisations, digging into Expert Advisors.


But there are working systems and this is the motivation - to make NS/II/machine understand the nuances of working with probability theory, using both short stops in time, not in a hurry to close, and the right time to be out of the market and wait for ideal conditions.

Many people are struggling with this problem - to formalise the extraction of money on Forex, many have managed to do it on very even, as they write, simple, reliable and not greedy advisors, the main thing for them is a complex percentage and multiplicity of these advisors, as they showed Chinese traders: Grandmothers are sitting, knitting socks, in front of each monitor, one experienced trader is walking around and showing grandmothers what should be the next move according to his experience and concepts, well, and apparently everyone knows how and what to do in case of what, they probably have some money... and not small ))))

[Deleted]  
Сергей Криушин #:

Many people are struggling with this problem - to formalise the extraction of money on Forex, many have managed to do it on very even, as they write, simple, reliable and not greedy advisors, the main thing for them is the complex percentage and multiplicity of these advisors, as they showed Chinese traders: Grandmothers are sitting, knitting socks, in front of each monitor, one experienced trader is walking around and showing grandmothers what should be the next move according to his experience and concepts, well, and apparently everyone knows how and what to do in case of what, they probably have some money... and not small ))))

Why do you need forex, pension is more reliable.

 
Nikolai Starkovskii #:

You don't need forex, retirement is safer.

How much is your pension? I recently went to Gosuservices, to date I have calculated 17 tonnes. And it's still 5 years away, thanks to our leader, who never-never-never lies! Well, when he sleeps, certainly does not lie ))) So one hopes for a head start.

 
Alexey Volchanskiy #:

How much is your pension? I recently went to Gosuservices, and as of today I have calculated 17 tonnes. And it is still 5 years away, thanks to our leader, who never-never-never lies! Well, when he sleeps, certainly does not lie ))) So one hopes for a head start.

One is better than the other, such a hope.
 
Alexey Volchanskiy #:

How much is your pension? I recently went to Gosuservices, and as of today I have calculated 17 tonnes. And it is still 5 years away, thanks to our leader, who never-never-never lies! Well, when he sleeps, certainly does not lie ))) So one hopes for a head start.

Hello, smoker is alive, yes, this our, pension they there twist as they want, do not accept any confirmation even with stamps, accidentally witnessed their conversations ... consider in their favour every nick or incorrect writing in the employment book or in the payroll, there is such a deaf bureaucracy that it is better to go straight to court, and if there are no deductions to the pension, they do not talk at all.

 
Alexey Volchanskiy #:

And how much is your pension?

People are now taking the funded part of their pensions. But it's been saved for the state, not the citizens. For 10 years the state used this money for free.

 

look again if you feed the difference in prices or increments - which will be better than the totals or not?

I'll look at it myself later... (while other projects are in progress) in my opinion, in this approach the totals will be ok if ok to submit.... )

 
Renat Akhtyamov #:

somewhere on the forum put an advisor on Mashka, which made the chat GPT

the most interesting thing is that the code analyses the МАшка both in the direction of increasing the number of bars and decreasing it.

of course, I did not try to apply this in practice due to repeated fiascoes when using indicators, but I think there is something in it.

---

TC asked a question on the topic of trading on MN1

I think that the idea of such trading due to the decent lag of indicators will eventually come down to analysing the economic situation rather than the chart.

Oh yes!!! Mashki of the middle of the last century is our everything )) One should realise that this is a simple FIR filter without coefficients. To be more precise, MT5 delivery also has BIH, but it doesn't change the essence of the matter. That's why mashki gives such a wild lag, even in comparison with the FIR calculated on Matlab.