Converting MT4 indicator to cTrader

Created at 09 Jan 2022
jani's avatar

jani

Joined 05.04.2019

Status

In progress


Budget

75.00 EUR


Payment Method

via  Freelancer

Job Description

I have a simplified version of an MT4 indicator that draws another pair price (EURUSD) as a line on top of the current symbol.

 

Below are the details of the project:

1) I would like to have this indicator translated to cAlgo.

2) I would like to add an option to reset the calculation variable number of days lookback. For example, using value = 1, indicator would start comparing prices from the last open daily bar, value =2 would compare data for the last 2 days and so on. A new day is considered to start when a new daily bar is formed, which  I believe is currently 22:00 UTC.

Day change can be set forexample with: 

 MarketData.GetBars(TimeFrame.Daily).OpenTimes.Last(i)

where "i" is the lookback public parameter

 

Completion

5-10 business days.


Payment

I would prefer to do the project at freelancer.com.

If you want to do the project directly I will pay after the work is complete and I have the indicator with source code, if you don't agree to this we have to do this over freelancer.com.

I can also make a partial payment if I get the indicator for testing without source code and indicator works properly.

Direct payment with PayPal or USDC

Here is how the indicator looks at MT4

 

MQL code  below:

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Red


#property indicator_color7 CadetBlue
#property indicator_color8 DarkOrchid

extern   int line_centre = 400;  
extern   int dir_EurUsd = 1;  


int   ia, ib, ic, id, ie = 0;
int   cnt1, cnt2, temp0, temp1 = 0;
double   centre_EurUsd,centre_curent ; 

//---- buffers
double ExtMapBuffer1[];

double ExtMapBuffer7[];
double ExtMapBuffer8[];

double EurUsd[], GbpUsd[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   
   SetIndexStyle(6,DRAW_LINE);
   SetIndexBuffer(6,ExtMapBuffer7);
   
   SetIndexStyle(7,DRAW_LINE);
   SetIndexBuffer(7,ExtMapBuffer8);
   
  /* */
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   ObjectDelete("EurUsd");
;  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars = IndicatorCounted();
//---- 
   ArrayCopySeries(EurUsd, MODE_CLOSE, "EURUSD", Period());
 
   
   //
   temp0 = Bars - 1;
   
   if(ArraySize(EurUsd) < temp0 + 1)  
     {
       temp0 = ArraySize(EurUsd) - 1;
       Comment("ìàëî äàííûõ íà EurUsd " + Period() + " " + ArraySize(EurUsd));
     }


   if(line_centre >= temp0) 
     {
       Comment("ÍÅÕÂÀÒÀÅÒ ÄÀÍÍÛÕ Â ÀÐÕÈÂÀÕ.... ");
       return(0);
     }
   //
   if(temp0 - line_centre < Bars - counted_bars)  
       temp1 = temp0 - line_centre;
   else  
       temp1 = Bars - counted_bars;
//----
   for(ia = temp1; ia >= 0; ia--) 
     {
       //
       centre_EurUsd = 0;
       centre_curent = 0;
       //----
       for(ic = line_centre - 1; ic >= 0; ic--) 
         {
           centre_EurUsd = centre_EurUsd + EurUsd[ia+ic]; 
 
           centre_curent = centre_curent + Close[ia+ic]; 
         }
       centre_EurUsd = centre_EurUsd / line_centre;

          centre_curent = centre_curent / line_centre;
       //
       ExtMapBuffer1[ia] = (dir_EurUsd*EurUsd[ia] + (1 - dir_EurUsd) / 
                            EurUsd[ia])*centre_curent / (dir_EurUsd*centre_EurUsd + 
                            (1 - dir_EurUsd) / centre_EurUsd);

       if((Bars-counted_bars) == 1)   
         {
           //
           ObjectDelete("EurUsd");
           ObjectCreate("EurUsd", OBJ_TEXT, 0, Time[0] + Period()*11*60, ExtMapBuffer1[0]);
           ObjectSet("EurUsd", OBJPROP_COLOR, Brown);
           ObjectSetText("EurUsd", "EurUsd " + DoubleToStr(EurUsd[0], 4), 8, "arial");
           //----


         }

 
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

 

Comments
Log in to add a comment.
VI
viniciustaparosky · 2 years ago

Hello I can do that fot you.

Please contact me on my telegram: +55 41 985051801

 

Thanks.

4xdev.team's avatar
4xdev.team · 2 years ago

Hello!
My name is Mike from 4xdev. I am a member of the 4xdev development company, specialized in creating trading tools:
custom indicators, EAs, scripts, bots, alerts, cAlgo, cBots, etc.

We have a great experience in a сTrader platform.
Our clients are satisfied with the quality of our work and repeatedly contact us after completing an order to optimize their own cAlgos.
You can see reviews of us at forexpeacearmy.com and trustpilot.com, and our website 4xdev.com.

We can help you with your project. Please let me know if you are interested: support@4xdev.com

We offer the rate in the amount of $60 per hour, including the work of our programmers and QA-engineer.
The cost starts from $300 on average.

Looking forward to hearing from you.

ctrader.guru's avatar
ctrader.guru · 2 years ago

Hi there, (we offer you 20% discount if you reply within 5 days from the date of this message)

We can help you with your project. You can contact us at :

Best Regards, 

cTrader Guru Team

Waxy's avatar
Waxy · 2 years ago

Hello Jani,

I can do this work for you, will send a proposal on freelancer, just in case here's my profile

Regards,
Xavier R