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

 
novator:

Good evening, I have no logic in the code, I just need to sell when the range of the last three bars shrinks to 20 pips.


#define MAGIC 123456
extern double rastvor=20;
int start()
{
 
 for (int i=1;i>OrdersTotal();i++)
 {
  if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false)break;
  if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGIC)
  { 
   double UpLev=iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,3,0));
   double DnLev=iLow(NULL,0,iLowest(NULL,0,MODE_LOW,3,0));
   double summ = UpLev-DnLev;
   if (UpLev-DnLev<=rastvor)
   {
    OrderSend(Symbol(),OP_BUY,0.2,Ask,3,0,0,"",MAGIC,0,Red);
    return(0);
   }
  }
 }
} 


Pay more attention:
 if (UpLev-DnLev<=rastvor*Point)
 

One more thing. First of all,

for (int i=0;i<OrdersTotal();i++)

... and secondly, that should be removed altogether. Just leave it:

int start()
{
 
   double UpLev=iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,3,0));
   double DnLev=iLow(NULL,0,iLowest(NULL,0,MODE_LOW,3,0));
   double summ = UpLev-DnLev;
   if (UpLev-DnLev<=rastvor*Point)
   {
    OrderSend(Symbol(),OP_BUY,0.2,Ask,3,0,0,"",MAGIC,0,Red);
    return(0);
   }
} 
 

i Open (Symbol (),0,0)

If I understand correctly, this function returns the Bid price of the zero bar

Which function returns theAsk price of the zero( and any) bar instead of the Bid price?

Thank you.

 
Vinin:

A file name is passed as a parameter, with a point followed by a file extension. For example "Test.dat".


Thank you!!!! And what extension do I need, in my case?
 
solnce600:

i Open (Symbol (),0,0)

I understand correctly, this function returns the Bid price of the zero bar

Q.What function returns theAsk price of the zero( and any) bar instead of the Bid price?

Thank you.

Ask, as a spread, is not fixed in history. But at the moment, in order to use it as a signal to act in an Expert Advisor, you can write it by adding the spread to this function and normalizing it accordingly: Ask = NormalizeDouble(iOpen(Symbol(),0,0)+spread,Digits); or simply Ask!
 

http://photoload.ru/data/c4/9a/b1/c49ab15e130c84a1ca9c51711fcf423a.jpg I still don't understand the logic of indicators. For example, if you take a standard Moving Average indicator.

It's in the start:

switch(MA_Method)
     {
      case 0 : sma();  break;
      case 1 : ema();  break;
      case 2 : smma(); break;
      case 3 : lwma();
     }
The next step is a call of the function selected by the user... from the window that has appeared in the indicator chart. Right?

There is a piece of code in INIT that I commented out:

//---- indicator short name
  /* switch(MA_Method)
     {
      case 1 : short_name="EMA(";  draw_begin=0; break;
      case 2 : short_name="SMMA("; break;
      case 3 : short_name="LWMA("; break;
      default :
         MA_Method=0;
         short_name="SMA(";
     }
   IndicatorShortName(short_name+MA_Period+")");*/

And yet in the DataWindow the name is written. Here's a screenshot:

The question arises. Why do I need this piece of code in INIT at all?

 
Dimka-novitsek:

Good evening! The function

parameter File should contain a conditional word and an abbreviation in it, separated by a dot. What abbreviation should I use if I don't know where I want to put the

array double Mass[,2]; ?


Sorry, I'm in extensions, not really what would work for me?
 
Dimka-novitsek:

I'm sorry, I'm in extensions, not really which one would suit me?

Any one you like (unless of course you want to process the information with other programmes).
 
Thank you!
 
hoz:

http://photoload.ru/data/c4/9a/b1/c49ab15e130c84a1ca9c51711fcf423a.jpg I still don't understand the logic of the indicators. For example, if you take a standard Moving Average indicator.

It is in the start:

Everything is logical, the next step is the call of the function selected by the user... from the window that has appeared when stretching on the indicator chart. Right?

There is a piece of code in INIT that I commented out:

And yet in the DataWindow the name is written. Here's a screenshot:

The question arises. Why does INIT need this piece of code at all?


These are the methods of averaging of the indicator.