[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 144

 
somewhere on this site long time ago I met a link to a site where you can upload your robot, as well as specify the username, password, server and it will trade when my copm is off.... can anyone remember this site?
 
jobber:
somewhere on this site long time ago I met a link to a site where you can upload your robot, as well as specify the username, password, server and it will trade when my copm is off.... does anyone remember this site?

You may enter VPS in search engine, I don't know what it means literally, but it could be a virtual desktop for traders.
 
splxgf:

LazarevDenis

The initial count is 59 bars, which is incorrect. There may be gaps in minutes, and the last hour bar may contain fewer minutes.

You should take the hour bar open and close time (Time[i]). Use this time to calculate offsets for iBarShift minutes, and then calculate the maximum within this range of offsets.

By the way, what should the indicator show on a minute period?

Although, it doesn't matter for the Expert Advisor, it only needs to get the last value on one-minute bars, if the number is positive the price goes up, if it is negative it goes down, by returning the number modulo it shows the strength of the movement.


as for the number of bars - their 60 counts from zero and there is no 60 minutes as this is the zero minute of the new hour, or am I mistaken

I have doubts about the last hour bar, but I hope that since there are no min bars at all, their volume is equal to zero and they do not affect the result of calculations

I made a minute bar to check the adequacy of calculations, so I have identified that I have an error, marked the beginning and end of the hour, and the maximum value in the horizontal indicator, then switched to a minute bar and checked, 6 hour bars were fine, and then something went wrong

 
LazarevDenis:


as for the number of bars - their 60 counts from zero and there is no 60 minutes, as it is the zero minute of the new hour, or am I mistaken

I have doubts about the last hour bar, but I hope that since there are no minute bars at all, their volume is zero and they do not affect the calculation results

i created a minute bar to check the adequacy of the calculations, and i have defined that i have an error. On the hour bar i marked the beginning and the end of the hour, and the maximum value in the horizontal indicator, then switched to the minute bar and checked, 6 hour bars were fine, and then something went wrong


Write or provide your code?
 
Vinin:

Write or provide your code?
I'm a bit confused about what to write?
the indicator code is on the previous page, i will add the EA when i make sure the indicator works properly, thanks
 
//+------------------------------------------------------------------+
//| FT_Fractal_MA.mq4 |
//| FORTRADER.RU, Yuri, ftyuriy@gmail.com |
//| http://FORTRADER.RU, Fractals + Averages |
//+------------------------------------------------------------------+
#property copyright "FORTRADER.RU, Yury, ftyuriy@gmail.com"
#property link "http://FORTRADER.RU, Fractals + Averages"

/* Developed for the 49th issue of FORTRADER.Ru. System on fractals and averages.
Reports: http://finfile.ru/index.php/files/get/6qQW8tgENy/fracralma1.zip, http://finfile.ru/index.php/files/get/_glRYiHkQi/fracralma2.zip
Set files: http://finfile.ru/index.php/files/get/k2w2e92iCI/eurusd1h.zip
Discussion: http://fxnow.ru/group_discussion_view.php?group_id=49&grouptopic_id=266&grouppost_id=2667#post_2667
Log archive: http://www.fortrader.ru/arhiv.php
Issue 49: http://www.fortrader.ru/
*/

extern int lwmaper1=4;
extern int lwmaper2=8;

extern int int lwmapertrend=40;
extern int lwmatrendchart=1;

extern int SL=150;
extern int TP=150;

extern int mn=1;

int err;

extern int MG=564651;
extern double Lots=0.01;

extern int maxpos=1;

int bars;
int start()
{
if(bars!=Bars)
{
bars=Bars;
OpenPattern();
}
return(0);
}

int okbuy; }

int OpenPattern()
{
double op,sl,tp;
double upf=iFractals(NULL, 0, MODE_UPPER, 3);
double dwf=iFractals(NULL, 0, MODE_LOWER, 3);
double lwma1=iMA(NULL,0,lwmaper1,0,MODE_LWMA,PRICE_CLOSE,1);
double lwma2=iMA(NULL,0,lwmaper2,0,MODE_LWMA,PRICE_CLOSE,1);
double lwma1Last=iMA(NULL,0,lwmaper1,0,MODE_LWMA,PRICE_CLOSE,2);
double lwma2Last=iMA(NULL,0,lwmaper2,0,MODE_LWMA,PRICE_CLOSE,2);
double lwmatrend=iMA(NULL,GetPeriod(lwmatrendchart),lwmapertrend,0,MODE_LWMA,PRICE_CLOSE,1);
double lwmatrendLast=iMA(NULL,0,GetPeriod(lwmatrendchart),0,MODE_LWMA,PRICE_CLOSE,2);
if(upf!=0){oksell=1;okbuy=0;}
if(dwf!=0){okbuy=1;oksell=0;}
if(oksell==1 && lwma1<lwma2 && lwma1Last>lwma2Last && CountPos(0)<maxpos && lwmatrend>lwmatrendLast)
{
op=Bid;if(SL>0){sl=Bid+SL*Point*mn;}if(TP>0){tp=Bid-TP*Point*mn;}
err=OrderSend(Symbol(),OP_SELL,Lots,NormalizeDouble(op,Digits),3,NormalizeDouble(sl,Digits),NormalizeDouble(tp,Digits), "4 FORTRADER.RU",MG,0,Red);
if(err<0){Print("OrderSend()- Error OP_SELL. op "+op+" sl "+sl+" tp "+tp+""+GetLastError());return(-1);}
oksell=0;
}
if(okbuy==1 && lwma1>lwma2 && lwma1Last<lwma2Last && CountPos(1)<maxpos && lwmatrend<lwmatrendLast)
{
op=Ask;if(SL>0){sl=Ask-SL*Point*mn;}if(TP>0){tp=Ask+TP*Point*mn;}
err=OrderSend(Symbol(),OP_BUY,Lots,NormalizeDouble(op,Digits),3,NormalizeDouble(sl,Digits),NormalizeDouble(tp,Digits), "6 FORTRADER.RU",MG,0,Red);
if(err<0){Print("OrderSend()- Error OP_BUY. op "+op+" sl "+sl+" tp "+tp+""+GetLastError());return(-1);}
okbuy=0;
}
return(err);
}
//Check the number of positions.
int CountPos(int type)
{// Description http://fxnow.ru/blog.php?user=Yuriy&blogentry_id=66

int i;
int col;
int count=0 ;
for( i=0; i<=OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS)==true)
{
if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && type==1 && OrderMagicNumber()==MG){count++;}
if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && type==0 && OrderMagicNumber()==MG){count++;}
}
}
return(count);
}

int GetPeriod(int GrafOpen)
{int GrafOpenT;
switch(GrafOpen)
{
case 1: GrafOpenT=1;break;
case 2: GrafOpenT=5;break;
case 3: GrafOpenT=15;break;
case 4: GrafOpenT=30;break;
case 5: GrafOpenT=60;break;
case 6: GrafOpenT=240;break;
case 7: GrafOpenT=1440;break;
default: GrafOpenT=1;break;
}
return(GrafOpenT);

}

Please swap buy and sell in this EA from this site, I am having trouble with it. It is interesting to check it, because it seems to be too flat.

 
LazarevDenis:


as for the number of bars - their 60 counts from zero and there is no 60 minutes as this is the zero minute of the new hour, or am I mistaken

I'm going to ask a silly question now, how many daily bars there are in a year?
 

Goodnight... morning... or maybe even afternoon...

I am trying to learn mql language... I am facing a misunderstanding... The essence of the problem is in the code:

      OrderSelect(ТикетСелл,SELECT_BY_TICKET);
      double СеллТейкПрофит=ЦенаПродажи-(ЦенаПокупки-ЦенаПродажи);
      PrintDoubleToStr("OrderOpenPrice()= ",OrderOpenPrice(),8);PrintDoubleToStr("ЦенаПродажи= ",ЦенаПродажи,8);
      PrintDoubleToStr("OrderStopLoss()= ",OrderStopLoss(),8);PrintDoubleToStr("ЦенаПокупки= ",ЦенаПокупки,8);
      PrintDoubleToStr("OrderTakeProfit()= ",OrderTakeProfit(),8);PrintDoubleToStr("СеллТейкПрофит= ",СеллТейкПрофит,8);
      Print(OrderType(),"=",OP_SELLSTOP);
      if((OrderType()==OP_SELLSTOP) && ((OrderOpenPrice()!=ЦенаПродажи)||(OrderStopLoss()!=ЦенаПокупки)||(OrderTakeProfit()!=СеллТейкПрофит)))
      {
         OrderModify(OrderTicket(),ЦенаПродажи,ЦенаПокупки,СеллТейкПрофит,0,Red);
      }

PrintDoubleToStr" function prints double numbers to the log...

In general, in my journal (Read from bottom to top).

2011.09.04 22:56:36	2011.08.01 00:00  Прямоугольник EURUSD,H1: OrderModify error 1
2011.09.04 22:56:36	2011.08.01 00:00  Прямоугольник EURUSD,H1: 5=5
2011.09.04 22:56:36	2011.08.01 00:00  Прямоугольник EURUSD,H1: СеллТейкПрофит= 1.41884000
2011.09.04 22:56:36	2011.08.01 00:00  Прямоугольник EURUSD,H1: OrderTakeProfit()= 1.41884000
2011.09.04 22:56:36	2011.08.01 00:00  Прямоугольник EURUSD,H1: ЦенаПокупки= 1.44244000
2011.09.04 22:56:36	2011.08.01 00:00  Прямоугольник EURUSD,H1: OrderStopLoss()= 1.44244000
2011.09.04 22:56:36	2011.08.01 00:00  Прямоугольник EURUSD,H1: ЦенаПродажи= 1.43064000
2011.09.04 22:56:36	2011.08.01 00:00  Прямоугольник EURUSD,H1: OrderOpenPrice()= 1.43064000

There is a question: Why does it modify the order if all values are equal and therefore this condition is not met:

if((OrderType()==OP_SELLSTOP) && ((OrderOpenPrice()!=ЦенаПродажи)||(OrderStopLoss()!=ЦенаПокупки)||(OrderTakeProfit()!=СеллТейкПрофит)))
Please tell me where I went wrong...
 
niknikolas:

Please tell me where I went wrong...

I won't catch a fish, but I'll give you a fishing rod... you can also add a line Print(OrderOpenPrice()!=Sale Price) and the picture will be complete and sufficient for independent conclusions.
 
splxgf:
I won't catch a fish, but I'll give you a fishing rod... you can add more lines Print(OrderOpenPrice()!=SellTakeProfit) and the picture will be complete and sufficient for independent conclusions.

As they say, "What's in it for me?" I need a worm... Anyway, here's the code:

OrderSelect(ТикетСелл,SELECT_BY_TICKET);
double СеллТейкПрофит=ЦенаПродажи-(ЦенаПокупки-ЦенаПродажи);
Print("OrderOpenPrice()!=ЦенаПродажи= ",OrderOpenPrice()!=ЦенаПродажи);
Print("OrderStopLoss()!=ЦенаПокупки= ",OrderStopLoss()!=ЦенаПокупки);
Print("OrderTakeProfit()!=СеллТейкПрофит= ",OrderTakeProfit()!=СеллТейкПрофит);
PrintDoubleToStr("OrderTakeProfit()= ",OrderTakeProfit(),8);
PrintDoubleToStr("СеллТейкПрофит   = ",СеллТейкПрофит,8);
if((OrderType()==OP_SELLSTOP) && ((OrderOpenPrice()!=ЦенаПродажи)||(OrderStopLoss()!=ЦенаПокупки)||(OrderTakeProfit()!=СеллТейкПрофит)))
{
 OrderModify(OrderTicket(),ЦенаПродажи,ЦенаПокупки,СеллТейкПрофит,0,Red);
}
In the journal:
2011.09.05 00:21:32     2011.08.01 00:00  Прямоугольник EURUSD,H1: OrderModify error 1
2011.09.05 00:21:32     2011.08.01 00:00  Прямоугольник EURUSD,H1: СеллТейкПрофит   = 1.42505000
2011.09.05 00:21:32     2011.08.01 00:00  Прямоугольник EURUSD,H1: OrderTakeProfit()= 1.42505000
2011.09.05 00:21:32     2011.08.01 00:00  Прямоугольник EURUSD,H1: OrderTakeProfit()!=СеллТейкПрофит= 1
2011.09.05 00:21:32     2011.08.01 00:00  Прямоугольник EURUSD,H1: OrderStopLoss()!=ЦенаПокупки= 0
2011.09.05 00:21:32     2011.08.01 00:00  Прямоугольник EURUSD,H1: OrderOpenPrice()!=ЦенаПродажи= 0

Why with " SellTakeProfit = 1.42505000" and with "OrderTakeProfit()= 1.42505000" still "OrderTakeProfit()!=SellTakeProfit= 1 "

It's not clear in general...