How do I retrieve data from an indicator? - page 5

 
_new-rena:

...With your hands when?

The scientific method where? ....


Here's the first result:

//+------------------------------------------------------------------+

//| Sovetnik_RegressionPolynomial.mq4 |

//| Retabs 2014 |

//| www.----- |

//+------------------------------------------------------------------+

#property copyright "Retabs 2014"

#property link "www.-----"

#property version "1.00"

#property strict

//--- input parameters

input int StopLoss=60;

input int TakeProfit=100;

input double Lots=1.00;

input int Shift=5;

//+------------------------------------------------------------------+

//| Expert initialization function |

//+------------------------------------------------------------------+

int OnInit()

{

//---

//---

return(INIT_SUCCEEDED);

}

//+------------------------------------------------------------------+

//| Expert deinitialization function |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

{

//---

}

//+------------------------------------------------------------------+

//| Expert tick function |

//+------------------------------------------------------------------+

void OnTick()

{

//---

double val1=iCustom(NULL,0,"RegressionPolynomial",10000,55,5,2,0,1,0);

double val2=iCustom(NULL,0,"RegressionPolynomial",10000,55,5,2,0,2,0);

if(val1>val2)OrderSend(Symbol(),OP_BUY,Lots,Ask,Shift,StopLoss,TakeProfit,"коммент",5371533,0,Red);

else OrderSend(Symbol(),OP_SELL,Lots,Bid,Shift,StopLoss,TakeProfit,"коммент",5371533,0,Blue);

}

//+------------------------------------------------------------------+
 

Just don't understand why it gives an error in the tester.

 
Retabs:

Just don't understand why it gives an error in the tester.


Please insert the code via the SRC button and with an easy-to-read tab!!! And delete your sprawl!

Then I'll delete your code pasted according to the rules!

And the first thing to do is to read the beginner's advice in this thread with the triangle:

Forum navigator and answers to frequently asked questions. Highly recommended reading! ( 1 2 3 4 5 6 ) 5218.02.2011FAQ
 
borilunad:

Please insert code via the SRC button and with an easy-to-read tab!!! And delete your spoofing!

Then I'll delete your code pasted according to the rules!

And the first thing to do is to read the beginner's advice in this thread with the triangle:

Forum navigator and answers to frequently asked questions. Highly recommended reading! ( 1 2 3 4 5 6 ) 5218.02.2011FAQ



I will be corrected. Already insertedcode via SRC button.

Why then will you delete my code if it is, as you wrote, pasted by the rules?

 
Retabs:

Just don't understand why it gives an error in the tester.

Keep it in mind and use the biggest chisel on your nose - the programming count starts at 0. Indicator buffers are no exception.
 
evillive:
Take it in stride and use the biggest chisel on your nose - programming counts from 0. Indicator buffers are no exception.


Wrapped it up. Fixed it. Only the error wasn't fixed. Same, in strategy tester log - Sovetnik_RegressionPolynomial EURUSD,M1: OrderSend error 130

 

No one knows why?

 
Retabs:


Here is the first result:

Finally.

The 130 error is due to the stops and takeovers. There should be a price level at which they should trigger. (certainly not waiting for price -100 or 60, there should be something like Price-100*Point or Price+60*Point, for example)

 
_new-rena:

Finally.

The 130 error is due to the stops and takeovers. There should be a price level at which they should trigger. (Surely not waiting for price -100 or 60, should be like Price-100*Point or Price+60*Point, for example)


Thank you. Will fix it now.
 
_new-rena:

Finally.

The 130 error is due to the stops and takeovers. There should be a price level at which they should trigger. (certainly not waiting for price -100 or 60, there should be something like Price-100*Point or Price+60*Point, for example)


I did it! Took me a long time, error 130 disappeared, but others appeared, got rid of them too. It's working now.

Open at Buy and Sell and close at TP or SL . Only it opens a lot of them now!

How to limit opening one trade until the other is closed?

//+------------------------------------------------------------------+
//|                                Sovetnik_RegressionPolynomial.mq4 |
//|                                                      Retabs 2014 |
//|                                                        www.----- |
//+------------------------------------------------------------------+
#property copyright "Retabs 2014"
#property link      "www.-----"
#property version   "1.00"
#property strict
//--- input parameters
input int   StopLoss=60;
input int   TakeProfit=100;
input double   Lots=0.10;
input int   Shift=5;

double SL;
double TP;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   double val1=iCustom(NULL,0,"RegressionPolynomial",10000,55,5,2,0,0,0);
   double val2=iCustom(NULL,0,"RegressionPolynomial",10000,55,5,2,0,1,0);
   
 
   if(val1>val2)
   OrderSend(Symbol(),OP_BUY, Lots,Ask,Shift,Ask-StopLoss*Point,Ask+TakeProfit*Point,"коммент",5371533,0,Red);
   
   
   if(val1<val2)
   OrderSend(Symbol(),OP_SELL,Lots,Bid,Shift,Bid+StopLoss*Point,Bid-TakeProfit*Point,"коммент",5371533,0,Blue);
   
   
  }
//+------------------------------------------------------------------+
Reason: