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

 
drknn:


Start with the definition of the problem.

- Use the script to detect the presence of a line on the chart.

- If the line exists, print its start and end price to the variables; print the bar numbers (or time) to the variables.

- Make necessary calculations using the script.

- Print the results to the screen (or to a text document or to the Expert Advisor Journal)

If you don't manage to solve these 4 problems right away, start by learning the language.


drknn! thank you! I'll look into it!!!
 
Zhunko:

It's no secret. There's a lot written about it. It doesn't matter what tool was used to create the story. The point is to update the chart so that the Expert Advisor works on it.

This can be done by means of WinAPI. It has been described here many times. I have written a library. I posted it here.

It contains functions to control autonomous update of the chart. It does not require any script or expert. But it is not for everyone. There are also functions available to all to update the chart from an Expert Advisor, a script or an indicator. It is more difficult to use them. Because you have to think out which of your programmes will update the chart. Examples are in the test script.

Do you happen to have a ready-made solution for "extracting" the last line of the log file to display in the comments?
 

Help a nerd out. Just to brush up on the essence of the question.

I have two points on the chart, point 2 - the one closer to the zero bar and t.1 - the one further away from the zero bar in the history. I try to draw a trend line from these two points,

by extending a segment between these points by N (variable int RayLong) intervals ahead. The code is as follows:

if (RayLong!=0 && point1s==true && point2s==true)
{
//расчет цены в будущем
if (price11s>price22s) {price11s=NormalizeDouble(price11s+((price11s-price22s)*RayLong),Digits);} 
if (price11s<price22s) {price11s=NormalizeDouble(price11s-((price22s-price11s)*RayLong),Digits);}
//расчет бара в будущем
int bis=iBarShift(Symbol(),0,time22s,true)-iBarShift(Symbol(),0,time11s,true);
Print("Sup "+iBarShift(Symbol(),0,time22s,true)+" "+iBarShift(Symbol(),0,time11s,true)+" "+bis+
" sec="+bis*Period()*60*NormalizeDouble(RayLong,Digits)+" Time="+TimeToStr(time11s+(Period()*60*
(iBarShift(Symbol(),0,time22s,true)-iBarShift(Symbol(),0,time11s,true)+1)*RayLong),TIME_DATE|TIME_SECONDS));
time11s=time11s+(Period()*60*((iBarShift(Symbol(),0,time22s,true)-iBarShift(Symbol(),0,time11s,true))*RayLong));
//time11s=time11s+((time11s-time22s)*RayLong); //альтернативный вариант предыдущей строки
}
The problem is the calculation point is floating on the date. The price is OK. The date, on the other hand, is either fine or floating. Print shows that this happens when the settlement date is not on the schedule - weekends or holidays. Please suggest a solution to the problem.
 
forexnew:
Do you happen to have a ready-made solution for "extracting" the last line of the log file to display in the comments?
This is useless. The log file is filled in after the MT4 upload or when MT4 has time to do so.
 
ZZZEROXXX:

Help a nerd out. Just to brush up on the essence of the question.

I have two points on the chart, point 2 - the one closer to the zero bar and t.1 - the one further away from the zero bar in the history. I try to draw a trend line from these two points,

by extending a segment between these points by N (variable int RayLong) intervals ahead. The code is as follows:

The problem is that the calculation point is floating on the date. Everything is OK with the price. The date, on the other hand, is either fine or floating. I use Print to figure out that this happens when the settlement date is not on the schedule - weekends or holidays. Please advise me how to solve this problem.

I don't understand the problem. If you are drawing by price and bars There are no weekend or non-weekend bars on the chart. So the trend and should continue to the next bars corresponding to the dates of trading days.

Or is it different for you?

 

Could you please tell me if the array will be filled with pending order tikets in the following code:

int tiket[];

int SetFunk()

{

for (i=0; i<=k-1; i++)

{
ticket[i]=OrderSend(Symbol(),OP_BUYSTOP,0.01*Lots,Ask+Step*i*Point,3,Bid-S_Loss*Point,0,",10000,0,Green);

ticket[i+k]=OrderSend(Symbol(),OP_SELLSTOP,0.01*Lots,Bid-Step*i*Point,3,Ask+S_Loss*Point,0,"",10000,0,Green);

}

}

?????
nulls are returned when trying to print()

 
What is the static memory class for? If possible, can you give a good example of its use in code and highlight the features that make it stand out from other memory classes? This thing seems to be useless, who knows what?
 
myrzila:

Could you please tell me if the array will be filled with pending order tikets in the following code:

int tiket[];

int SetFunk()

{

for (i=0; i<=k-1; i++)

{
ticket[i]=OrderSend(Symbol(),OP_BUYSTOP,0.01*Lots,Ask+Step*i*Point,3,Bid-S_Loss*Point,0,",10000,0,Green);

ticket[i+k]=OrderSend(Symbol(),OP_SELLSTOP,0.01*Lots,Bid-Step*i*Point,3,Ask+S_Loss*Point,0,"",10000,0,Green);

}

}

?????
nulls are returned when trying to print()

first set the size of the array (ArrayResize) and then work with it
 

Hello.

I have an EA.

How can I get it to show the moving average levels shown in the picture?

Right now it just shows zeros.


//+------------------------------------------------------------------+
//| expert initialisation function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialisation function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
SetLabel("MA_LABEL",DoubleToStr(iMA(Symbol(),13,30,8,MODE_SMA,PRICE_CLOSE,0)-0.0015,0),Red,10,20,0,20);
SetLabel("MA_LABEL2",DoubleToStr(iMA(Symbol(),13,30,8,MODE_SMA,PRICE_CLOSE,0),0),Red,10,50,0,20);
//----
return(0);
}
//+------------------------------------------------------------------+


void SetLabel(string nm, string tx, color cl, int xd, int yd, int cr=0, int fs=9) {
if (ObjectFind(nm)<0) ObjectCreate(nm, OBJ_LABEL, 0, 0,0);
ObjectSetText(nm, tx, fs);
ObjectSet(nm, OBJPROP_COLOR, cl);
ObjectSet(nm, OBJPROP_XDISTANCE, xd);
ObjectSet(nm, OBJPROP_YDISTANCE, yd);
ObjectSet(nm, OBJPROP_CORNER, cr);
ObjectSet(nm, OBJPROP_FONTSIZE, fs);
}




 
emilien:


Hello.

I have an EA.

How can I get it to show the moving average levels shown in the picture?

Right now it just shows zeros.


//+------------------------------------------------------------------+
//| expert initialisation function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialisation function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
SetLabel("MA_LABEL",DoubleToStr(iMA(Symbol(),13,30,8,MODE_SMA,PRICE_CLOSE,0)-0.0015,0),Red,10,20,0,20);
SetLabel("MA_LABEL2",DoubleToStr(iMA(Symbol(),13,30,8,MODE_SMA,PRICE_CLOSE,0),0),Red,10,50,0,20);
//----
return(0);
}
//+------------------------------------------------------------------+


void SetLabel(string nm, string tx, color cl, int xd, int yd, int cr=0, int fs=9) {
if (ObjectFind(nm)<0) ObjectCreate(nm, OBJ_LABEL, 0, 0,0);
ObjectSetText(nm, tx, fs);
ObjectSet(nm, OBJPROP_COLOR, cl);
ObjectSet(nm, OBJPROP_XDISTANCE, xd);
ObjectSet(nm, OBJPROP_YDISTANCE, yd);
ObjectSet(nm, OBJPROP_CORNER, cr);
ObjectSet(nm, OBJPROP_FONTSIZE, fs);
}




double iMA( string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift)

I haven't heard about timeframe 13 yet