[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 341

 
silhouette:

Thank you.

But I can't understand the point of creating a time measurement. After all, there are several bars in a series and their times are different. This way it is not possible to record the series.

One more thing: I can't understand where there is a logical error in my code. What is the reason why it doesn't work? Without it, any attempt to redo anything is useless.

Why the time in the series? Well, for example, (I don't know what statistics you want to collect) when processing statistical data, it would be useful to know not only the value, but also the time of that value. When graphing in excel you would be able to clearly see the location of the series and the data in that series, their relative position to each other (red and green), etc. If you don't need it, don't use it.

I haven't looked at your code and can't say where the logical error is. I remember - you made it based on Victor's indicator (Vinin), why not ask Victor about that?

 

What do I need to know for a beginner in addition to downloading the platform, Expert Advisor, where to start?

 
manik5:

What do I need to know for a beginner in addition to downloading the platform, Expert Advisor, where to start?


What do you need to know? A Trading primer and Forex programming documentation. What are you more interested in?
 
drknn:

A primer on trading and documentation on forex programming. What are you more interested in?

I am interested in what to put where, what to pay attention to.
 
manik5:

I'm interested in what to put where, what to pay attention to.

So - a primer on trading...
 
manik5:

I am interested in what to put where and what to pay attention to.

In terms of trading:
Place orders into the market, stop orders to the server (same place). Pay attention to global changes of price direction.

In terms of programming:

Before writing a program, work out (at least in your head) its algorithm. Perhaps the rest of the program will pick up as a trailer, you only need to ask the right questions.

 
paladin80:

In the order loop, check with an OrderMagicNumber operator such as this:



Thank you for your reply, but you probably misunderstood me. I am interested in how to distinguish between orders with an empty magic, which have been opened by an EA, and orders opened manually, by a user. In both, OrderMagicNumber gives out 0.

 
no way
 

my handheld RSI becomes the main window

how to insert RSI in the main window "0" ? what to change ? indicator_chart_window- changed

+------------------------------------------------------------------+
//|                                                          RSI.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
//---- input parameters
extern int RSIPeriod=14;
//---- buffers
double RSIBuffer[];
double PosBuffer[];
double NegBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- 2 additional buffers are used for counting.
   IndicatorBuffers(3);
   SetIndexBuffer(1,PosBuffer);
   SetIndexBuffer(2,NegBuffer);
//---- indicator line
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,RSIBuffer);
//---- name for DataWindow and indicator subwindow label
   short_name="RSI("+RSIPeriod+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);
//----
   SetIndexDrawBegin(0,RSIPeriod);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Relative Strength Index                                          |
//+------------------------------------------------------------------+
int start()
  {
   int    i,counted_bars=IndicatorCounted();
   double rel,negative,positive;
//----
   if(Bars<=RSIPeriod) return(0);
//---- initial zero
   if(counted_bars<1)
      for(i=1;i<=RSIPeriod;i++) RSIBuffer[Bars-i]=0.0;
//----
   i=Bars-RSIPeriod-1;
   if(counted_bars>=RSIPeriod) i=Bars-counted_bars-1;
   while(i>=0)
     {
      double sumn=0.0,sump=0.0;
      if(i==Bars-RSIPeriod-1)
        {
         int k=Bars-2;
         //---- initial accumulation
         while(k>=i)
           {
            rel=Close[k]-Close[k+1];
            if(rel>0) sump+=rel;
            else      sumn-=rel;
            k--;
           }
         positive=sump/RSIPeriod;
         negative=sumn/RSIPeriod;
        }
      else
        {
         //---- smoothed moving average
         rel=Close[i]-Close[i+1];
         if(rel>0) sump=rel;
         else      sumn=-rel;
         positive=(PosBuffer[i+1]*(RSIPeriod-1)+sump)/RSIPeriod;
         negative=(NegBuffer[i+1]*(RSIPeriod-1)+sumn)/RSIPeriod;
        }
      PosBuffer[i]=positive;
      NegBuffer[i]=negative;
      if(negative==0.0) RSIBuffer[i]=0.0;
      else RSIBuffer[i]=100.0-100.0/(1+positive/negative);
      i--;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
spek:

my handheld RSI becomes the main window

how to insert RSI in the main window "0" ? what to change ? indicator_chart_window- changed


Interesting. RSI has calculated values ranging from zero to a hundred. And the prices on the chart, say, are less than 1. So how do you want to scale the RSI in the main chart window?
Reason: