Please fix this indicator or EA - page 50

 

dasio

You had an error with prices for opening orders

Now you have to control the total number of orders too (pending+regular orders)

Here is a quick workaround that limits the total number of orders to 2

extern int Magic = 68415;

extern int Orario_Inizio = 0;

extern int Orario_Fine = 6;

extern int Buffer = 0;

extern double Lotti = 0.1;

extern int TakeProfit = 10;

extern int StopLoss = 50;

double Massimo;

double Minimo;

int BarCount;

int BarStart;

int BarShift;

double MinLot;

double LotSize;

int i;

int ticket;

string Status;

string BuyStatus1;

string SellStatus1;

double Range;

string CommentoRange;

double pipMultiplier = 1;

int init()

{

}

int start()

{

if (Digits==3 || Digits==5)

{pipMultiplier = 10;}

else {pipMultiplier = 1; }

double TakeProfit1 = TakeProfit*Point*pipMultiplier;

double StopLoss1 = StopLoss*Point*pipMultiplier;

double Buffer1 = Buffer*Point*pipMultiplier;

double StopLossPrice = NormalizeDouble(StopLoss1,Digits);

double TakeProfitPrice = NormalizeDouble(TakeProfit1,Digits);

double BufferPrice = NormalizeDouble(Buffer1,Digits);

//CALCOLA LE BARRE DEL RANGE

if(Orario_Inizio>Orario_Fine)

{

BarCount=24+Orario_Fine-Orario_Inizio;

}

if(Orario_Inizio<Orario_Fine)

{

BarCount=Orario_Fine-Orario_Inizio;

}

//CALCOLA IL MASSIMO E IL MINIMO DEL RANGE

if(Hour()>=Orario_Fine)

{

BarStart=Hour()-Orario_Fine;

BarShift=BarStart+BarCount;

Minimo=iLow(NULL,PERIOD_H1,BarStart);

Massimo=0;

for(i=BarStart;i<=BarShift;i++)

{

Massimo=MathMax(Massimo,iHigh(NULL,PERIOD_H1,i));

Minimo=MathMin(Minimo,iLow(NULL,PERIOD_H1,i));

Range=(Massimo-Minimo)/Point;

}

}

else

{

Massimo=0;

Minimo=0;

return(0);

}

//CONTROLLA SE E' L'ORARIO PER POTER TRADARE

if(Hour()==Orario_Fine && OrdersTotal()<2)

{

//CONTROLLA SE IL MASSIMO E' STATO ROTTO. CONDIZIONE BUY

double OpenPriceBuy = NormalizeDouble((Massimo+BufferPrice),Digits);

ticket=OrderSend(Symbol(),OP_BUYSTOP,Lotti,OpenPriceBuy,0,OpenPriceBuy-StopLossPrice,OpenPriceBuy+TakeProfitPrice,NULL,Magic,0,Blue);

//CONTROLLA SE IL MINIMO E' STATO ROTTO. CONDIZIONE SELL

double OpenPriceSell = NormalizeDouble((Minimo-BufferPrice),Digits);

ticket=OrderSend(Symbol(),OP_SELLSTOP,Lotti,OpenPriceSell,0,OpenPriceSell+StopLossPrice,OpenPriceSell-TakeProfitPrice,NULL,Magic,0,Red);

if (ticket != -1)

return(0);

}

}

[/PHP]

dasio:
Thank you

[PHP]extern int Magic = 68415;

extern int Orario_Inizio = 0;

extern int Orario_Fine = 6;

extern int Buffer = 0;

extern double Lotti = 0.1;

extern int TakeProfit = 10;

extern int StopLoss = 50;

double Massimo;

double Minimo;

int BarCount;

int BarStart;

int BarShift;

double MinLot;

double LotSize;

int i;

int ticket;

string Status;

string BuyStatus1;

string SellStatus1;

double Range;

string CommentoRange;

double pipMultiplier = 1;

int init()

{

}

int start()

{

if (Digits==3 || Digits==5)

{pipMultiplier = 10;}

else {pipMultiplier = 1; }

double TakeProfit1 = TakeProfit*Point*pipMultiplier;

double StopLoss1 = StopLoss*Point*pipMultiplier;

double Buffer1 = Buffer*Point*pipMultiplier;

double StopLossPrice = NormalizeDouble(StopLoss1,Digits);

double TakeProfitPrice = NormalizeDouble(TakeProfit1,Digits);

double BufferPrice = NormalizeDouble(Buffer1,Digits);

//CALCOLA LE BARRE DEL RANGE

if(Orario_Inizio>Orario_Fine)

{

BarCount=24+Orario_Fine-Orario_Inizio;

}

if(Orario_Inizio<Orario_Fine)

{

BarCount=Orario_Fine-Orario_Inizio;

}

//CALCOLA IL MASSIMO E IL MINIMO DEL RANGE

if(Hour()>=Orario_Fine)

{

BarStart=Hour()-Orario_Fine;

BarShift=BarStart+BarCount;

Minimo=iLow(NULL,PERIOD_H1,BarStart);

Massimo=0;

for(i=BarStart;i<=BarShift;i++)

{

Massimo=MathMax(Massimo,iHigh(NULL,PERIOD_H1,i));

Minimo=MathMin(Minimo,iLow(NULL,PERIOD_H1,i));

Range=(Massimo-Minimo)/Point;

}

}

else

{

Massimo=0;

Minimo=0;

return(0);

}

//CONTROLLA SE E' L'ORARIO PER POTER TRADARE

if(Hour()==Orario_Fine)

{

//CONTROLLA SE IL MASSIMO E' STATO ROTTO. CONDIZIONE BUY

double OpenPriceBuy = NormalizeDouble((Massimo+Ask+BufferPrice),Digits);

ticket=OrderSend(Symbol(),OP_BUYSTOP,NormalizeDouble(Lotti,Digits),OpenPriceBuy,0,OpenPriceBuy-StopLossPrice,OpenPriceBuy+TakeProfitPrice,NULL,Magic,0,Blue);

//CONTROLLA SE IL MINIMO E' STATO ROTTO. CONDIZIONE SELL

double OpenPriceSell = NormalizeDouble((Minimo-Ask-BufferPrice),Digits);

ticket=OrderSend(Symbol(),OP_SELLSTOP,NormalizeDouble(Lotti,Digits),OpenPriceSell,0,OpenPriceSell+StopLossPrice,OpenPriceSell-TakeProfitPrice,NULL,Magic,0,Red);

if (ticket != -1)

return(0);

}

}
 
mrtools:
Hi Sara, Please check these out the first is a separate window version showing the square root(MathSqrt) of price however many days back you need to look by default set at 50. The chart version using the same values. Both are stand alone, and Thanks for the idea, very interesting.

hi mrtools

You are unique.

thanks so much.

 

Sara was noticing on my charts on certain times the text and line were scrambled together, am sure it was because of Sunday data problems, so added a fix for that, and it will depend if your broker has Sunday data or not. Should be good to go now.

Files:
 

hi

i want code or indicator,Write the number of days before in chart

ty.

Files:
capture.png  56 kb
 
sara129:
hi mrtools

i miss you

I added the indicator.Number Today, for the last few days, not repeat.

Thanks

Hi Sara,

Please check these out the first is a separate window version showing the square root(MathSqrt) of price however many days back you need to look by default set at 50. The chart version using the same values. Both are stand alone, and Thanks for the idea, very interesting.

ps) was just rereading this post and neglected to mention Mladen made the separate window indicator for my reference , if it wasn't for this would still be scratching my head how to do it. THANKS Mladen!!!

 
mrtools:
Sara was noticing on my charts on certain times the text and line were scrambled together, am sure it was because of Sunday data problems, so added a fix for that, and it will depend if your broker has Sunday data or not. Should be good to go now.

hi mrtools

Please add this MathSqrt(open today).I think it will be better.

Namely:

Angle = (sqrt+MathSqrt(open today))/2;

thanks.

 
sara129:
hi mrtools

Please add this MathSqrt(open today).I think it will be better.

Namely:

Angle = (sqrt+MathSqrt(open today))/2;
thanks.

Hi Sara,

Changed it to open price.

Files:
 
mrtools:
Hi Sara, Changed it to open price.

hi

Thanks to mrtools

Finally

Files:
capture_1.png  59 kb
 

eass

Hello and good day to all,

I found this EA based on Semafor on the net but I does not have take profit, stop loss or trail stop in it. I someone could please add those to the EA that would be great. I tried to mess around with it but no programming skills. Thank you.

P_P

Files:
 
Pip_Pimpster:
Hello and good day to all,

I found this EA based on Semafor on the net but I does not have take profit, stop loss or trail stop in it. I someone could please add those to the EA that would be great. I tried to mess around with it but no programming skills. Thank you.

P_P

Hello Pip_Pimpster,

Added all 3 but wasn't able to back test so please check and see if it works.

Files: