Wrote an advisor, there is a problem. - page 2

 
Noterday >> :
I've already set it to 100, it still gives me an error of 130. Which zigzag buffer should I use? ZigzagBuffer? Or should I use HighMapBuffer and LowMapBuffer? Oh, man. The code should be simple, but no one can tell me anything like that .....

if you are comparing it to high, it must be HighMapBuffer

 

Okay. Thanks for the answers) Once again I will describe what I need, if anyone else has anything to say...

How to do this: I need it to a certain action. When ZZ sets its point on Ihigh or Ilow bar, it won't matter if it redraws it afterwards or not. How do I do it? I guess the ZZ line itself is contained in ZigzagBuffer? Or do I need to use HighMapBuffer and LowMapBuffer in ZZ ?


 
Noterday >> :

So, no one can help?) Specifically, I need to do this: if the zigzag line drawn to HIGH or LOW, then I need to open a position (if the HIGH - sell, and if the LOW - buy), and it does not matter whether the redraw the zigzag or not. Here is a sample code, correct me if I am doing something wrong because the tester keeps showing ordersend error 130:



I would do the following:

int counted_bars=IndicatorCounted();

int i=Bars=counted_bars-1;

while(i>=0){

double ZZ_1 = iCustom(NULL,0, "ZigZag",0,0,1);

if (ZZ_1 == High[i+1]){
OrderSend(Symbol(),OP_SELL,Lot(),Bid,10,ZZ_1+(10*Point),Bid-(10*Point), "SELL",0,0,Red);

}
if (ZZ_1 ==Low[i+1] ){
OrderSend(Symbol(),OP_BUY,Lot(),Ask,10,ZZ_1-(10*Point),Ask+(10*Point), "BUY",0,0,Blue);

}

 
Noterday >> :

So, no one can help?) Specifically, I need to do this: if the zigzag line drawn to HIGH or LOW, then I need to open a position (if the HIGH - sell, and if the LOW - buy), and it does not matter whether the redraw the zigzag or not. This is a sample code, correct me if I'm doing something wrong because the tester keeps showing ordersend error 130:



>> Yes. Indicate the period of the indicator.
 
Noterday >> :

So, no one can help?) Specifically, I need to do this: if the zigzag line drawn to HIGH or LOW, then I need to open a position (if the HIGH - sell, and if the LOW - buy), and it does not matter whether the redraw the zigzag or not. This is a sample code, correct me if I'm doing something wrong because the tester keeps showing ordersend error 130:


Corrected:


int counted_bars=IndicatorCounted();

int i=Bars=counted_bars-1;

while(i>=0){

double ZZ_1 = iCustom(NULL,0, "ZigZag",0,0,i+1); // if the previous bar is needed

if (ZZ_1 == High[i+1]){
OrderSend(Symbol(),OP_SELL,Lot(),Bid,10,ZZ_1+(10*Point),Bid-(10*Point), "SELL",0,0,Red);

}
if (ZZ_1 ==Low[i+1] ){
OrderSend(Symbol(),OP_BUY,Lot(),Ask,10,ZZ_1-(10*Point),Ask+(10*Point), "BUY",0,0,Blue);

}
 
Nothing worked :( There were only ordersend error 130. Although I tried to put a stop of 200 pips :)
 

Even that doesn't help... there's something about this I don't like. OK, I'll look into it. THANK YOU ALL!!!! :)


 

or maybe you are getting Magic Number=0

 

I've never swear before... I think it's an optional parameter, especially as error 130 indicates an incorrect stop...


I was just thinking... maybe there's something wrong with my quotes and it can't get the prices right? Why would I think that? Because I can't scroll further than September 1, 2009. I've got 2000000 bars enabled in the settings.


I would like to try it with my own EA.

 

as for sigzag, try running the following code in the tester with speed set to minimum and throwing the indicator on the chart and use F12 to see what happens to the digits

in the upper left corner hope you can understand my thoughts on how to use this

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
double UP, DN;
int start()
  {
//----
double Buf_0 = iCustom(NULL, 0, "ZigZag", 0, 0);
double Buf_UP = iCustom(NULL, 0, "ZigZag", 1, 0);
double Buf_DN = iCustom(NULL, 0, "ZigZag", 2, 0);
if( Buf_UP != 0)  UP =  Buf_UP; // последние значение вершинки
if( Buf_DN != 0)  DN =  Buf_DN; // последние значение донышка
Comment("Буфер №0: ", Buf_0, "\n", "Буфер №1: ", UP, "\n", "Буфер №2: ", DN);
//----
   return(0);
  }
//+------------------------------------------------------------------+
Reason: