Add a Line on EURUSD

 

Hello,

I have been searching and reading documents to find a way how to draw a line on eurusd chart and the line , which I calculated by using other pairs prices, is the result of my calculation. Could anyone help me how to add this result on eurusd chart as a line ?

Thanks.

 
kerimhoroz:

Hello,

I have been searching and reading documents to find a way how to draw a line on eurusd chart and the line , which I calculated by using other pairs prices, is the result of my calculation. Could anyone help me how to add this result on eurusd chart as a line ?

Thanks.

https://docs.mql4.com/objects/objectcreate
 
4x_Gypsy:
https://docs.mql4.com/objects/objectcreate

I have seen this page before and I have tried the options whatever noted on this page. However, I could not find how to draw line which is the result of this ;

 The new line = gbpusd*2 + audusd*6

 I am not looking for VLINE, HLINE etc. I need to have the result as a line on eurusd chart.

 

I have tried these pages examples ;

https://book.mql4.com/samples/indicators

https://book.mql4.com/functions/objects

https://book.mql4.com/functions/icustom

https://book.mql4.com/samples/icustom

 
kerimhoroz:

 The new line = gbpusd*2 + audusd*6

 

That is meaningless

if you mean to calculate the line's price level from the Bids gbpusd*2 + audusd*6, then the line would be way off of the chart 

kerimhoroz:

 I am not looking for VLINE, HLINE etc. I need to have the result as a line on eurusd chart.

 Then what are you looking for?

 
GumRai:

That is meaningless

if you mean to calculate the line's price level from the Bids gbpusd*2 + audusd*6, then the line would be way off of the chart 

 Then what are you looking for?

What I am looking for is the result of gbpusd*2 + audusd*6 as a line on the eurusd chart. The factors of the pairs' prices will be calculated better and the result is going to be closer to 1.1117 which is the price level of eurusd currently.

Is there anyway to create the line which will be the result of calculation ? It is supposed to look like MA, but it is not.  

 
GumRai:

That is meaningless

if you mean to calculate the line's price level from the Bids gbpusd*2 + audusd*6, then the line would be way off of the chart 

 Then what are you looking for?

hell i am curious now. we will need to see your code for this because you are not making any sense.
 
4x_Gypsy:
hell i am curious now. we will need to see your code for this because you are not making any sense.
extern int Period_MA = 50;            // Calculated MA period
double ema;
double result;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {

//---
  double XAGUSD       = MarketInfo("XAGUSD",MODE_ASK);
  double USDJPY       = MarketInfo("USDJPY",MODE_ASK);
  double USDCHF       = MarketInfo("USDCHF",MODE_ASK); 
  double USDCAD       = MarketInfo("USDCAD",MODE_ASK);
  double GBPUSD       = MarketInfo("GBPUSD",MODE_ASK);
  double USDINDEX     = MarketInfo("#DXU5",MODE_ASK);
  double XAUUSD       = MarketInfo("XAUUSD",MODE_ASK);
  double SP500        = MarketInfo("#ESU5",MODE_ASK);
  double FTSE         = MarketInfo("#FFIU5",MODE_ASK);    
  double USOIL        = MarketInfo("#CLV5",MODE_ASK);
 
  

  result = 1.2382+0.000245*XAGUSD+0.000678*USDJPY+0.02318*USDCHF+0.04650*USDCAD-0.05350*GBPUSD-0.007118*USDINDEX
               -0.000014*XAUUSD+0.000019*SP500+0.000001*FTSE-0.000031*USOIL;

 
  Alert("Result = " , result);
  
  ema = iMA (NULL,0,50,0,MODE_EMA,PRICE_CLOSE,1);
  Alert("ortalama=",ema);
  if (Ask > ema && result > ema )
  Alert("Bid = ", Ask);
  
  
  if (Ask < ema && result < ema)
  Alert("Ask = ", Ask);

  return(INIT_SUCCEEDED);

  }

 

 

Nothing is extraordinary on my codes. I just could not find the right way to get the result as line on eurusd. By the way, I am still working on the equation. It is not giving me the best result yet. To test the results, I need to develope it by adding the result's line and automatic buy/sell orders.

  

 

 

 
kerimhoroz:
extern int Period_MA = 50;            // Calculated MA period
double ema;
double result;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {

//---
  double XAGUSD       = MarketInfo("XAGUSD",MODE_ASK);
  double USDJPY       = MarketInfo("USDJPY",MODE_ASK);
  double USDCHF       = MarketInfo("USDCHF",MODE_ASK); 
  double USDCAD       = MarketInfo("USDCAD",MODE_ASK);
  double GBPUSD       = MarketInfo("GBPUSD",MODE_ASK);
  double USDINDEX     = MarketInfo("#DXU5",MODE_ASK);
  double XAUUSD       = MarketInfo("XAUUSD",MODE_ASK);
  double SP500        = MarketInfo("#ESU5",MODE_ASK);
  double FTSE         = MarketInfo("#FFIU5",MODE_ASK);    
  double USOIL        = MarketInfo("#CLV5",MODE_ASK);
 
  

  result = 1.2382+0.000245*XAGUSD+0.000678*USDJPY+0.02318*USDCHF+0.04650*USDCAD-0.05350*GBPUSD-0.007118*USDINDEX
               -0.000014*XAUUSD+0.000019*SP500+0.000001*FTSE-0.000031*USOIL;

 
  Alert("Result = " , result);
  
  ema = iMA (NULL,0,50,0,MODE_EMA,PRICE_CLOSE,1);
  Alert("ortalama=",ema);
  if (Ask > ema && result > ema )
  Alert("Bid = ", Ask);
  
  
  if (Ask < ema && result < ema)
  Alert("Ask = ", Ask);

  return(INIT_SUCCEEDED);

  }

 

 

Nothing is extraordinary on my codes. I just could not find the right way to get the result as line on eurusd. By the way, I am still working on the equation. It is not giving me the best result yet. To test the results, I need to develope it by adding the result's line and automatic buy/sell orders.

  

 

 


  result = 1.2382+0.000245*XAGUSD+0.000678*USDJPY+0.02318*USDCHF+0.04650*USDCAD-0.05350*GBPUSD-0.007118*USDINDEX

               -0.000014*XAUUSD+0.000019*SP500+0.000001*FTSE-0.000031*USOIL;

where are the numbers that you are adding,subtracting,and multiplying coming from? are they the actual Ask prices or something else.

the equation really needs to be broken into manageable and readable parts and then put together to form whatever it is supposed to be.

example...

double 1 = (1.2382+0.000245)*XAGUSD;

double 2 = 0.000678*USDJPY;

double 3 = 0.02318*USDCHF;

double 4 = 0.04650*USDCAD;

double 5 = 0.05350*GBPUSD;

double 6 = 0.007118*USDINDEX;

double 7 =  0.000014*XAUUSD;

double 8 =  0.000019*SP500;

double 9 = 0.000001*FTSE;

double 10 = 0.000031*USOIL ;

result = 1+2+3+4-5-6-7+8+9-10;



 
kerimhoroz:

What I am looking for is the result of gbpusd*2 + audusd*6 as a line on the eurusd chart. The factors of the pairs' prices will be calculated better and the result is going to be closer to 1.1117 which is the price level of eurusd currently.

Is there anyway to create the line which will be the result of calculation ? It is supposed to look like MA, but it is not.  

Then you need to write an indicator and use a buffer for the line.

Look at a sample code for an MA and instead of the MA calculation for the buffer, replace it with whatever calculation you like, 

 
4x_Gypsy:

  result = 1.2382+0.000245*XAGUSD+0.000678*USDJPY+0.02318*USDCHF+0.04650*USDCAD-0.05350*GBPUSD-0.007118*USDINDEX

               -0.000014*XAUUSD+0.000019*SP500+0.000001*FTSE-0.000031*USOIL;

where are the numbers that you are adding,subtracting,and multiplying coming from? are they the actual Ask prices or something else.

the equation really needs to be broken into manageable and readable parts and then put together to form whatever it is supposed to be.

example...

double 1 = (1.2382+0.000245)*XAGUSD;

double 2 = 0.000678*USDJPY;

double 3 = 0.02318*USDCHF;

double 4 = 0.04650*USDCAD;

double 5 = 0.05350*GBPUSD;

double 6 = 0.007118*USDINDEX;

double 7 =  0.000014*XAUUSD;

double 8 =  0.000019*SP500;

double 9 = 0.000001*FTSE;

double 10 = 0.000031*USOIL ;

result = 1+2+3+4-5-6-7+8+9-10;


The numbers that I am adding, subtracting and multiplying coming from statistical calculations. They are stable.

I beleive that the equation is broken into manageable and readable parts and I put them together as you suggested.

Even if there is no error on this codes, it still not working properly. Could you help me out what I need to develope on this ?  

Please see the codes on the attachment. 

 

Files:
sonucs_1_.mq4  5 kb
 
GumRai:

Then you need to write an indicator and use a buffer for the line.

Look at a sample code for an MA and instead of the MA calculation for the buffer, replace it with whatever calculation you like, 

I have started taken sample codes for MA, Stochastic Oscillator and Alligator. I am trying to figure out what point should be developed to have line graphic on eurusd chart ?  

Please see the codes on the attachment. 

Files:
sonuc_3.mq4  4 kb