[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 236

 

Colleagues, I'm a bit confused.

You need to use the indicator to draw a line between two points


   SetIndexShift(0, DRAW_SECTION);
   SetIndexBuffer(0, z1);

   z1[1]=1.5;
   z1[2]=EMPTY_VALUE;
   z1[3]=EMPTY_VALUE;
   z1[4]=EMPTY_VALUE;
   z1[5]=EMPTY_VALUE;
   z1[6]=1.4;

It doesn't work like this, does it?
 
neoclassic >> :

Colleagues, a bit confused.

You need to use the indicator to draw a line between two points

And you take a look at the SetIndexShift help. Wrong function. Yours is SetIndexStyle.

PS: and if you draw lines using the formula y=kx+b, then the indicator will

is defined for every two points :-).

 
jartmailru >> :

And you have a look at the SetIndexShift help. Wrong function. Yours is SetIndexStyle.

PS: and if you draw lines using the formula y=kx+b, the indicator will

defined for every two points :-).

That's how it happens, more than one indicator written, shifter mixed up with stile :-) no error, I relaxed.... thanks :-)

 

Guys, can you help me change the indicator to draw an ellipse together with the parabola, I want to compare the results of the EA. It seems to me that ellipse is more suitable for stoploss than parabola. Does anyone have such an indicator. Based on ellipses? I would like to compare the results with those of a parabola.

Files:
 
001 писал(а) >>

Guys, can you help me change the indicator to draw an ellipse together with the parabola, I want to compare the results of the EA. It seems to me that ellipse is more suitable for stoploss than parabola. Does anyone have such an indicator. Based on ellipses? Thank you in advance.

I have tried to connect this indicator as an external one in my Expert Advisor. I do not understand what is wrong.

I have the following information in my indicator

extern double Step=0.0513;
extern double Maximum=0.46;

In my Expert Advisor:

extern double stepstop=0.005;
extern double maximumstepstop=0.05;

double sarstop=iCustom(NULL,0, "ParabolicM",stepstop,maximumstepstop,0,0);

As a result:

2009.09.25 17:01:42 2001.09.24 09:00 EnveIn EURUSD,M30: sarstop = 0.8625

2009.09.25 17:01:42 2001.09.24 09:00 EnveIn EURUSD,M30: sarstop = 0.8625

2009.09.25 17:01:42 2001.09.24 09:00 EnveIn EURUSD,M30: sarstop = 0.8625

2009.09.25 17:01:42 2001.09.24 09:00 EnveIn EURUSD,M30: sarstop = 0.8625

It means that the reading does not change

 

Hello!


I have a question about the Expert Advisor logic and due to the lack of any programming experience, I am appealing to those who understand it.

I have a code (found on a Western forums and can not remember the author's name unfortunately), which is supposed to register the intersection of lines of the stochastic indicator on four timeframes. If the main line is higher than the signal line on all timeframes, the code to open the order is executed. This idea is great, of course, but its implementation caused a lot of problems. After running it through the history I saw that sometimes the order is opened when the event is registered on only one timeframe. I can not understand what may be the problem, since it seems that the basic conditions are in place.


I would be grateful for any help!



double M1, S1, M2, S2, M3, S3, M4, S4;

string Sig;
string St;
double ticket;

int start()
{
M1=iStochastic(NULL,PERIOD_M15,14,3,3,MODE_SMA,0,MODE_MAIN,1);
S1=iStochastic(NULL,PERIOD_M15,14,3,3,MODE_SMA,0,MODE_SIGNAL,1);

M2=iStochastic(NULL,PERIOD_M30,14,3,3,MODE_SMA,0,MODE_MAIN,1);
S2=iStochastic(NULL,PERIOD_M30,14,3,3,MODE_SMA,0,MODE_SIGNAL,1);
M3=iStochastic(NULL,PERIOD_H1,14,3,3,MODE_SMA,0,MODE_MAIN,1);
S3=iStochastic(NULL,PERIOD_H1,14,3,3,MODE_SMA,0,MODE_SIGNAL,1);
M4=iStochastic(NULL,PERIOD_H4,14,3,3,MODE_SMA,0,MODE_MAIN,1);
S4=iStochastic(NULL,PERIOD_H4,14,3,3,MODE_SMA,0,MODE_SIGNAL,1);

St = "READY";

Sig = "NONE";

if(M1>S1, M2>S2 && M3>S3 && M4>S4)
{
Sig="LONG";
}
if(M1<S1, M2<S2 && M3<S3 && M4<S4)
{
Sig="SHORT";
}

if(St=="READY" && Sig=="LONG")
{
ticket=OrderSend(Symbol(),OP_BUY,LotSize,Ask,5,Bid-SL*Point,Bid+TP*Point,LongComment,Magic,0,Blue);
if(ticket>-1)
{
St="LONG ON";
}
}

if(St=="READY" && Sig=="SHORT")
{
ticket=OrderSend(Symbol(),OP_SELL,LotSize,Bid,5,Ask+SL*Point,Ask-TP*Point,ShortComment,Magic,0,Red);
if(ticket>-1)
{
St="SHORT ON";
}
}

}

 
if-t >> :

Hello!

I have a code (I found it on one of western forums and I don't remember the author's name unfortunately) which is supposedly ......

..... found that sometimes an order opens when an event registers on only one timeframe.

Will be grateful for help!



Maybe the problem is this strange entry :

if(M1>S1, M2>S2 && M3>S3 && M4>S4)
What does this mean ? -
(M1>S1, M2>S2

Maybe instead of a comma try the operator " && " ? (for both buy and sell)

 
rid >> :

Maybe the problem is this strange entry :

What does this mean ? -

Maybe instead of a comma try putting the operator " && " ? (for both buy and sell)

Rid, thank you very much for your reply! I made this mistake while rearranging variables (my head is already swollen and I make primitive mistakes). The original variant is correct:

if(M1>S1 && M2>S2 && M3>S3 && M4>S4)

But it doesn't work. I keep thinking maybe the St variable doesn't always get the right values? But in fact if the condition is not fulfilled the code shouldn't be executed... In general, I'm a programmer like a ballerina and I just can't do without help of professionals...


 

By the way, tried inserting a printout, but the variables seem to get the values right.

 

I tried to write my first indicator but it only draws one line instead of two.

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
//---- buffers
double Buf_1[], Buf_2[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0, Buf_1);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0, Buf_2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    i, 
          Counted_bars=IndicatorCounted();
//----
i=Bars- Counted_bars-1;           // Индекс первого непосчитанного
   while( i>=0) 
      {  
       Buf_1[ i]= Close[ i]; 
       Buf_2[ i]= Open[ i];
       i--;
      }
 
//----
   return(0);