[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 28

 
profit depends on the size of the lot... the size of the lot depends on the size of the leverage...
 

Faced with a problem:

I wrote a BBP MA Oscillator indicator

It works fine on the chart,

But when I call it from the EA the data does not match.

The set parameters are respectively the same.

BBP_0=iCustom("EURUSD",60, "BBP MA Oscillator",BBPPeriod9,MODE_SMA,SignalBBPPeriod9,MODE_SMMA,0,0);

The question is how it is possible?

 
//+------------------------------------------------------------------+
//|                                            BBP MA Oscillator.mq4 |
//|                                                   vasbsm@mail.ru |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "vasbsm@mail.ru"
#property link      ""

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Blue
#property  indicator_width1  2
//---- input parameters
extern int       BBPeriod=155;
extern int       TypeMA=MODE_SMA;
extern int       SignalMA=172;
extern int       Type_MA_Signal=MODE_SMMA;
//-----------------------------
double BBBuffer[];
double TempBuffer[];
double OsmaBuffer[];
double SignalBuffer[];

int init()
  {
   string short_name;
   IndicatorBuffers(4);
   IndicatorDigits(Digits);
   
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexDrawBegin(0, SignalMA);
   IndicatorDigits(Digits+2);
   
   SetIndexBuffer(0, OsmaBuffer);
   SetIndexBuffer(1, SignalBuffer);  
   SetIndexBuffer(2, BBBuffer);
   SetIndexBuffer(3, TempBuffer); 
   
   short_name="Bulls Bears Power MA("+ BBPeriod+","+ SignalMA+")";     
   IndicatorShortName( short_name);
   SetIndexLabel(0, short_name);   
   return(0);
  }
int deinit()
  {

   return(0);
  }
int start()
  {
   int counted_bars=IndicatorCounted();
   if(Bars<= BBPeriod) return(0);
//----------------------------------------------------------------
   int limit=Bars- counted_bars;
   if( counted_bars>0) limit++;
   for(int i=0; i< limit; i++)
      TempBuffer[ i]=iMA(NULL,0, BBPeriod,0, TypeMA,PRICE_CLOSE, i);
//----------------------------------------------------------------
   i=Bars- counted_bars-1;
   while( i>=0)
     {
      BBBuffer[ i]=High[ i]+Low[ i]-2* TempBuffer[ i];
      i--;
     }
   i=Bars- counted_bars-1;
   while( i>=0)
     {
      SignalBuffer[ i]=iMAOnArray( BBBuffer,Bars, SignalMA,0, Type_MA_Signal, i);
      i--;
     }
   i=Bars- counted_bars-1;
   while( i>=0)
     {
      OsmaBuffer[ i]= BBBuffer[ i]- SignalBuffer[ i];
      i--;
     }         
   return(0);
  }
 

I've discovered an interesting feature now...

(it's probably already described somewhere, but I try to use my brain first and then a textbook ;)))

Which allowed me to use one more IF type selection criterion (filter)

orders += OrderProfit()<1;

Besides a common, traditional IF filter that selects the necessary orders,

introduction of the condition in the code above has selected orders with a profit less than 1.

*

I don't even know if this is correct or not, but it seems to work...

 
zfs >> :

Faced with a problem:

I wrote a BBP MA Oscillator indicator

It works fine on the chart,

But when I call it from the EA the data does not match.

The set parameters are respectively the same.

BBP_0=iCustom("EURUSD",60, "BBP MA Oscillator",BBPPeriod9,MODE_SMA,SignalBBPPeriod9,MODE_SMMA,0,0);

The question is how it is possible?

and if by default

BBP_0=iCustom(NULL,0, "BBP MA Oscillator",0,0);

and this is obviously wrong

if( counted_bars>0) limit++

it should be

if( counted_bars>0) limit--;
 

JavaDev, Granit77 thanks for the answers..... and although I still didn't get the answer to my main question, I decided to read the tutorial further. Perhaps the answer to my question will become clearer in the process.

 
GGeoZ >> :

...and although I still didn't get an answer to my basic question, I decided to read the textbook further. Perhaps the answer to my question will become clearer in the process.

I hope SK. is not watching this thread, so I will "share what I've read" in the tutorial. As a normal dumb user, I just skip the incomprehensible parts in the hope that "it will sort itself out". Your question didn't even occur to me (age, you know...). For internal use it was accepted that int is everything that can be counted on fingers, and double - everything else. :))

 
People can someone answer my question... the interesting thing is that the order of divergence is insignificant, but critical... I'd be happy to share a profitable strategy based on this and another indicator. There may be some error in the calculations...
 
granit77 писал(а) >>

I hope SK. is not watching this thread, so I will "share what I've read" in a textbook. As a normal dumb user, I just skip the obscure parts in the hope that "it will sort itself out". Your question didn't even occur to me (age, you know...). For internal use it was accepted that int is everything that can be counted on fingers, and double - everything else. :))

Bravo!!!

It was a pleasure to giggle. I don't get the questions either.

Just in case, I'd add my neighbour's fingers.

 
Gentlemen, please advise how to calculate the maximum lot size to open with all available funds.
Reason: