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

 
Urain писал(а) >>

Write a bool function() to check if the difference between the price and the set stoploop is greater than the StopLoss (from marketinfo)

then true otherwise false.

Then before opening an order you should check if(function()) and open an order.


Why do I need it if I set stop loss 30% more than stop loss in this brokerage company?

khorosh wrote >>

2 and 3 points are wrong. Right: Stop Loss and Take Profit for buy set off from Ask, Stop Loss and Take Profit for sell set off from Bid.
The check is simple. Calculate what gain, if takeprofit has triggered, you will get with your variant. It will not be equal to TakeProfit in points. In the proposed variant, it will be exactly equal.


So, I modified it as before and got the same result. I left only the price normalization.
But the error in the tester remains and the most interesting thing is that it repeats itself not for all orders but for some of them.
It has error 4107 for 1 out of 10 orders and it returns the other 9 without errors.

 

Помогите пожфлуйста с индикаторами: 1-й чтобы не убирал разметку на графике. 2-й чтобы лини старших ТФ были внешними на младших и чтобы можно было задать отоброжение(после того как задаешь отоброжение сразу все нормально пока не перещелкнешь ТФ,после этого все линии младших ТФ на старших)нии младших ТФ на старших)

 
I forgot...
Files:
macd.rar  7 kb
 
2
Files:
multi.rar  9 kb
 
baltik писал(а) >>


Why do I need it if I set Stop Loss 30% more than Stop Level in my brokerage company?


So I redid it as it was and the result is still the same, I have only left price normalization.
But the error in the tester remained and the most interesting thing is that I have errors in some orders and not in all of them.
For 1 of 10 it gave out error 4107, and the other 9 are processed without errors.


Show me the code, let's have a look at it.
 
Noterday >>:
Народ, у меня проблема, причем никак не могу допетрить в чем дело, особо не пинайте.
Есть стандартный MACD, хочу в индикаторе отметить все пики столбцов (значками), вот код:
Таким образом я нарисовал все экстремумы в индикаторе. Всё ОК, НО!
Когда функцией Print я вывожу значения всех найденых пиков
то вот что выходит:
Я так понимаю что 2147483647 это нули или пустые значения?

Well, can't anyone help? :)

 
Noterday писал(а) >>

Well, can't anyone help? :)


The problem seems to be with the MAX and MIN arrays.
Do you have them linked to the indicator buffers with SetIndexBuffer() ?

 
Yes, of course :)
 
Noterday писал(а) >>
Yes, of course :)


Do you use IndicatorBuffers() function?

 
Here's the full code:
#property indicator_separate_window
#property indicator_buffers 4

#property indicator_color1 MediumPurple
#property indicator_color2 MediumPurple
#property indicator_color3 Green
#property indicator_color4 Red

#property indicator_width3 1
#property indicator_width4 1


extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;

double MMACD1[];
double SMACD1[];
double MAX[];
double MIN[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{

SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexStyle(1,DRAW_LINE);

SetIndexStyle(2,DRAW_ARROW);
SetIndexStyle(3,DRAW_ARROW);
SetIndexArrow(2,119);
SetIndexArrow(3,119);

SetIndexDrawBegin(1,SMACD1);
IndicatorDigits(Digits+2);

SetIndexBuffer(0,MMACD1);
SetIndexBuffer(1,SMACD1);
SetIndexBuffer(2,MAX);
SetIndexBuffer(3,MIN);

IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+")");
SetIndexLabel(0,"MACD");
SetIndexLabel(1,"Signal");

return(0);
}
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();

if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;

for(int i=0; i<limit; i++)
MMACD1[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);

for(i=0; i<limit; i++)
SMACD1[i]=iMAOnArray(MMACD1,Bars,SignalSMA,0,MODE_SMA,i);

for(i=0; i<limit; i++)
{
if(MMACD1[i+1] > MMACD1[i+2] && MMACD1[i+1] > MMACD1[i])
MAX[i+1] = MMACD1[i+1];

if(MMACD1[i+1] < MMACD1[i+2] && MMACD1[i+1] < MMACD1[i])
MIN[i+1] = MMACD1[i+1];
}

for(i=0; i<limit; i++)
{
if (MAX[i+1] != EMPTY_VALUE)
Print(MAX[i+1]);
}

return(0);
}
//+------------------------------------------------------------------+