Fit a sine wave

지표

작업 종료됨

실행 시간 19 일
고객의 피드백
Good job, did a lot of effort, thanks.

명시

I have an indicator, it's an oscillator. I want to plot a sine wave on it that fits its shape closely: for this it needs to change amplitude, phase and period (frequency) all the time (because the oscillator is based on the market, which is not periodic). One of the buffers in the code should be the period of the sine wave: this is what I am interested in as an input for other indicators, so I should be able to use that: comment in the code which buffer it is in, and the code should be written that it is easy for me to take that value as an input for another indicator, or other code that will be added by me. So the idea is to break down an existing indicator into sine waves: decompose the signal with a 1 term Fourier decomposition f(x) =  a0 + a1*cos(x*w) + b1*sin(x*w). Fourier theory states that if the signal is stationary, you can break down any signal using sine and cosine functions as basis functions. 

The transition from the first sine wave (orange) with the first period (40) into the next sine wave (blue) with the next period (50) can be smooth if the difference in periods is not too large and the phase of the next wave is chosen to smoothly continue the previous one: the key thing is that the phase will have a value as if it was continuing the same wave: only the period and amplitude change: if you look at the red rectangle, you see that the blue curve is almost a continuation of the orange curve: in sine wave terminology this means that the phase of the combined wave only changed a little more than what one would expect if the orange wave would continue.

s1 

 The important element here is that the shape needs to be continuous: no sudden changes unless the input signal (indicator it’s calculated on) changes really suddenly.

 s2

 So above the picture is somewhat wrong because it thinks of this task as trying to fit segments of sines to the input signal: this is not really the case: you need to use the trick with the phase (use previous’ bar sine’s phase) to create a continuous output signal.

 s3

 

 

Above, if you look at the blue curve in Figure 1, you see that it first goes up, it accelerates its increase, then it reaches a maximum and then it goes down: first a bit quicker, then a bit slower. Now if you cut the blue line where the small vertical red lines are drawn you get pieces A, B & C as in Figure 2: green, yellow and gray respectively. Now if I look at the sine wave indicator that I attached, and leave the phase at 0 and the period at 1, and I play a bit with the period variable to get a sine wave from which part A could be cut out of, I see, after a bit of trial and error, that part A could be a part from a sine wave with a period of 40 (approximately: I did this manually, so I'm probably off by a more than a few digits): as you see in Figure 3: the red curve (sine wave with period 40) can pretty much follow the green curve (part A) without any interruption. The same goes for Figure 4 where the yellow curve (more or less: remember I drew it manually) is the start for a continuously flowing sine wave with period 50. In Figure 5 we see again that part C fits right into a part of a sine wave with period 120.

 

So in this example, the blue line is a combination of 3 sine waves: one with period 40, that turns into one with period 50, that gradually transforms into one with period 120. The interesting element is that we can see this in real time: if the period of the wave would be a constant 40,like in part A, there would be no fit any more. In fact there is probably an increase between part A and B: I should have put another piece in there because the blue line keeps increasing too long: this is where the period should be increased, and maybe even the amplitude also. So you are actually continuously fitting pieces of sine waves onto your input data.

 

 

Please use this type of loop:

 

int start()

  {

   int limit;

   //double ...;

   int counted_bars=IndicatorCounted();

   if(counted_bars<0) return(-1);

   if(counted_bars>0) counted_bars--;

   limit=Bars-counted_bars;

 

   for(int i=0; i<limit; i++)

   {   

 

   // here comes your code

 

   }

   return(0);

  }

 

 

The indicator will be given in a private message once you accept the project. I can also give you a primitive sine wave indicator in mql4 (that doesn't change phase, frequency and amplitude) and a linear regression indicator. 

응답함

1
개발자 1
등급
(7)
프로젝트
17
18%
중재
5
0% / 60%
기한 초과
9
53%
무료
비슷한 주문
Looking for someone who can teach me how to connect to Mt4 from phyton, code and backtest on phyton. This will be ongoing classes, once or twice a week for 1 hour
Patrex Pro Indicator 30 - 50 USD
I need patrex pro like indicator based on 2 Moving average crossover of 10 and 23 with timeframe in the dashboard. I am including the photos under and it shud nearly or exactly match as in the photo. Thank you
I'm planning on building/creating an mt4/5 trading indicator that use a break and retest strategy I will share a link for the idea strategy, Kindly message me to send you the link, I can't send it here
I am looking for a custom trading indicator for the Nasdaq 100 with the following requirements: Profit and Stop-Loss Targets: The system should aim to make $60 per trade and limit losses with a $30 stop-loss . High Win Rate: The target win rate should be 90% , based on the strategy and technical analysis. Daily Trading: The indicator should assess daily trends and place trades accordingly, ensuring trades are
I would like to request the development of a trading robot with the following specifications: High Win Rate: The robot should aim for a win rate between 80% and 90%. The strategy and algorithm used must be optimized for consistent performance and minimal drawdown. Weekly Market Direction: The robot needs to analyze the market at the beginning of the week and determine the overall direction (bullish or bearish). This
Hi, I need to get a new single Indicator , the result of the union of three already existing indicators (attached), let's call them "sub-indicators". Indicator must generate a continuous green/red output signal in a separate chart window . The 3 sub-indicators to combine are: Trend Arrows xSuperTrend MTF & alerts Wave Entry Alerts Multi TF These sub-indicators return, two of them continuous signal at each bar (
We are seeking an experienced developer to create a custom Expert Advisor (EA) for Forex trading, integrating Artificial Intelligence (AI). The EA should be capable of autonomously analyzing data, reading news feeds, and making intelligent trading decisions. Responsibilities: - Develop a Forex trading EA with AI integration. - The EA must fetch and analyze news from trusted sources to inform trading decisions. -
I will provide the code for an indicator, that draws channels (similar to bollinger bands) on the current chart. Please change this indicator, so that I can attach it to a chart with a given timeframe e.g. M15 and it calculates & draws the channels for e.g. H4 and D1 on the chart. User Inputs: - Use Timeframe1 [bool] - Timeframe1 [M1-Monthly] - Use Timeframe2 [bool] - Timeframe2 [M1-Monthly] - Deviations [e.g. 2.0] -
I need developer to convert trading view indicator " trend line breakout with target " by chart prime into mt5 expertadvisor. Additionally add moving Average to detect the trend. Buy when above MA and sell below MA. MA must be able to manually adjust. Also should be able to disable if needed.if disable follow only indicator signals. Only the developer who has experience can apply
DON'T REACH OUT IF YOU CAN'T CONVERT STRATEGY ON TRADINGVIEW TO A WELL AUTOMATED EXPERT ADVISOR THAT RUN WITHOUT PROBLEM ON METATRADER 5 Well, I am only looking for a programmer who is proficient in coding and can turn strategy on tradingview to a well customized expert advisor, please reach out if you can work timely on exactly what I just said

프로젝트 정보

예산
100 - 150 USD
VAT (21%): 21 - 31.5 USD
총: 121 - 181.5 USD
개발자에게
90 - 135 USD
기한
에서 1  7 일