Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 730

 

Good afternoon! The text below and the picture below are taken from a description of one of the indicators on the internet. As far as I understand it it is about EMA of first and second degree. Can you please give me the formula for the second degree or links to the description of similar themes on this forum. Thank you very much.


The principle of CONNECT (smoothing)

If X1 is the value of graph (let us suppose it fluctuates from minus X1 to plus X1), the point X5 with coordinates (0;0) is the last point of the averaged line, then the value of X2 will be obtained by averaging of the first degree or by a line (Archimedean lever - we lose in distance but gain in strength), and the value of X3 will be obtained by averaging of the second degree or by square parabola. It can be seen that a parabola provides a smoother averaging line. As the degree and length of the arm increase the smoothness increases. From a mechanical point of view, the change in X1 when averaging to the first degree is associated with a change in velocity, and when averaging to the second degree with a change in acceleration. As a result of averaging N last points are related by the corresponding equation.

Principle of LINEAR INTERPOLATION

It is known that you need at least two points to draw a straight line, three points to draw a square parabola, four points to draw a cubic parabola, etc.Or X4 and X5 for first degree interpolation and X4, X5 and X6 for second degree interpolation. In order for interpolated points to form a reasonably smooth line, either the degree or the shoulder of the interpolation must be less than the degree or the shoulder of the averaging. If the degree and the leverage are equal, we will obtain the initial value of X1. (The indicator works on points of the last bar opening)

The straight line is an arithmetic progression to get the third point after the first two:

U3= (U2-U1)+U2 = 2*U2 - U1 is a first degree reciprocal equation for equally spaced points. (Similar to the equation after reducing all the coefficients of the Lagrange equation)


TRIGONOMETRIC INTERPOLATION principle.

Let us use the formula for the sine of a double angle: Sin 2a = 2* Cos a* Sin a . Geometrically, it can be proved as follows: Sin 2a = 2* Cos a* Sin a - 0

And respectively: Sin 3a = 2* Cos a* Sin 2a - Sin a etc. where Cos a is the cosine of the angle of one step and Sin is essentially the corresponding value of the graph. Then the first-degree return equation for a sine angle near zero looks like Y3 = 2* Cos a * Y2 - Y1 . We see a complete analogy to the equation for a straight line. In the indicator the transition from trigonometric equations to linear equations is provided by assigning a period equal to one. Cos 360 equals 1 , then the equation degenerates into a linear one.
 

The picture didn't show up in the previous post.

 
evillive:
PeriodSeconds() is the name of built-in function, most probably wrong call in the code, show line 25.

I'm trying to use PeriodSeconds(), to delete a pending order on a new bar of the current timeframe.

If you know how to do it correctly, please advise.

//----глобальные переменные 
int PeriodSeconds(ENUM_TIMEFRAMES  period=PERIOD_CURRENT);
//----ф-ия start

int ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,Ask,3,stoploss,takeprofit,"MAxx",MAGICMA,PeriodSeconds(),clrGreen);
 

Good evening!

How do I specify the external parameters of the script, so that when it runs it defaults to Friday of the current week, time 23:00

Example

2014.10.10 23:00:00

//------- External parameters of the script -----------------------------------------+

extern datetime DT = ?

 
skyjet:

I'm trying to use PeriodSeconds(), to delete a pending order on a new bar of the current timeframe.

If you know the correct way, please advise.

//----глобальные переменные 
int PeriodSeconds(ENUM_TIMEFRAMES  period=PERIOD_CURRENT);
//----ф-ия start

int ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,Ask,3,stoploss,takeprofit,"MAxx",MAGICMA,PeriodSeconds(),clrGreen);
//----глобальные переменные 
int  per; 
per=PeriodSeconds(PERIOD_CURRENT); // вызывать там где надо по алгоритму. Нельзя объявлять предопределённую функцию, только вызывать с нужными параметрами и значение присваивать пользовательской переменной

int ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,Ask,3,stoploss,takeprofit,"MAxx",MAGICMA,TimeCurrent()+600,clrGreen); //срок истечения  отложенного ордера не может быть меньше 10 минут с момента его выставления

 
Somewhere it was mentioned an article or something else with the help of programming methods of Expert Advisors, working with one pair on an account, on which there are other or similar Expert Advisors, but with other pairs and, accordingly, with other values of parameters. You can't do only symbol and magician check, because it all cannot be done in loops. I looked through all the articles and did not find it in the search. Maybe someone will give me a hint! Thank you!
 
borilunad:
Somewhere was mentioned an article or something else with the help of programming methods of Expert Advisors, working with one pair on an account, on which there are other or similar Expert Advisors, but with other pairs and, accordingly, with other values of parameters. You can't do only symbol and magician check, because it all cannot be done in loops. I looked through all the articles and did not find it in the search. Maybe someone will give me a hint! Thank you!
Boris, can you elaborate? It's kind of a jumble.
 
Hello! Can you help us, please? Suppose we have several MAs (3,4,...,10,...) with different periods. How to find the MA with the largest (smallest) value on the current bar? Thank you.
 
artmedia70:
Boris, can you elaborate? It's a bit confusing.
Thanks for the response, Artyom! I'm making an expert now, not requiring much of a safety margin. I tried it by hand on a few pairs, and it works fine! That's why I want to setan EA for every pair, but they should not interfere with each other and be completely independent, even their working hours may not coincide! I will optimize each of them separately in the tester. What else do I need to understand that they will be so free-loving at me! ;)
 
prom18:
Hello! Can you help us, please? Suppose we have several MAs (3,4,...,10,...) with different periods. How to find the MA with the largest (smallest) value on the current bar? Thank you.
Use MathMaxes by pairing! Then for 4 you need 3MathMax's and for 8 respectively 7MathMax's. Good luck!
Reason: