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

 
Infinity:

Then how do I do it, for example, if I catch a 1-point coefficient and RSI is 50, it turns out that it is 50, but in fact it was a flat. And the candle has 2 points. In such a case, how to determine

The price moved up by one pip. Some calculations were made in RSI. Its value changed by X. The price passed another pip up. The indicator value should change again by the same x-value. Try to print it - it should turn out so.
 
xrust:

I understand that a trade signal should occur when the indicator line crosses the trend line, and not vice versa, but you have it both ways. Store previous values of trend line position in static variables and if they haven't changed - check for crossover, if trend line has changed position - reset...

Thank you, Rustam. Good idea! They say it right: one head is good, but the body is better... :)
 
artmedia70:
Thank you, Rustam. Good idea! It's true what they say: one head is good, but a body is better... :)

Hello, could you please tell me how to view the logs in MT4?
 
LAIT123:

Hello, could you please tell me how to view the TFG TFG data in MT4?

I guess I really need it... :) Or my mouse is stuck...

MT4/logs location folder

MT4\tester\logs location folder

I've got it right here:

D:\Program Files\MetaTrader - E-Global TFG account-1654729/logs

D:\Program Files/MetaTrader - E-Global TFG account-1654729\tester/logs

 

tell me why the data is not reset when the order is triggered? did i write the if(tic1>0) condition correctly to check if the order is open and i need to reset the variables to zero

int NewOrder1(int Cmd,double Lot)
{double TP=0; //тейкпрофит
double SL=0; //стоплосс
double PR=0; //Цена
double LT=0; //Лот
while(!IsTradeAllowed()) Sleep(100);
if(Cmd==OP_BUYLIMIT)
   {PR=Ask-Point*h;
    if(TakeProfit>0) TP=PR+TakeProfit*Point;
    if(StopLoss>0) SL=PR-StopLoss*Point;
    if(Lot>0) LT=3*Lot;}
int tic1=OrderSend(Symbol(),Cmd,LT,PR,3,SL,TP,0,mag,0,CLR_NONE);
//-----------
if(tic1<0) Print(GetLastError());

if(tic1>0){
   bool b=0,s=0, //соответственно бай или селл  
bs=0,// если закрытие по стоплоссу ордера бай
ss=0,// если закрытие по стоплоссу ордера sell
bt=0,
st=0;//      то же по ТП
double bl=0,sl=0; // лоты соответсвенно для бай и селл
}
//-----------
return(tic1);}
 
FoxUA:

tell me why the data is not reset when the order is triggered? did i write the if(tic1>0) condition correctly to check if the order is open and i need to reset the variables to zero

If memory serves me correctly, these variables have already been declared at global level...

And you re-declare them inside the function.

bool b=0,s=0, //соответственно бай или селл  
bs=0,// если закрытие по стоплоссу ордера бай
ss=0,// если закрытие по стоплоссу ордера sell
bt=0,
st=0;//      то же по ТП
double bl=0,sl=0; // лоты соответсвенно для бай и селл
They will only be visible inside the function. When you exit the function, their values will be lost and those declared globally will remain unchanged,
i.e. you declared new variables inside the function, but those that you want to change remain outside of it.
Remove bool and double from your code above.
 
artmedia70:
If memory serves me correctly, these variables have already been declared globally...

And you redeclare them inside the function.

They will be visible only inside the function. When you exit the function, their values will be lost and those declared globally will remain unchanged,
i.e. you declared new variables inside the function, but those that you want to change remain outside of it.
Remove bool and double from the above piece of your code.

I've removed them and I get a lot of errors when I compile

to these variables.

',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (143, 4)
'=' - assignment expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (143, 2)
',' - semicolon expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (143, 4)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (143, 4)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (143, 8)
'=' - assignment expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (143, 6)
',' - semicolon expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (143, 8)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (143, 8)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (144, 5)
'=' - assignment expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (144, 3)
',' - semicolon expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (144, 5)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (144, 5)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (145, 5)
'=' - assignment expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (145, 3)
',' - semicolon expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (145, 5)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (145, 5)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (146, 5)
'=' - assignment expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (146, 3)
',' - semicolon expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (146, 5)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (146, 5)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (148, 5)
'=' - assignment expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (148, 3)
',' - semicolon expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (148, 5)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (148, 5)

 
FoxUA:

removed and when compiled it gives out a bunch of errors

to these variables

',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (143, 4)
'=' - assignment expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (143, 2)
',' - semicolon expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (143, 4)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (143, 4)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (143, 8)
'=' - assignment expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (143, 6)
',' - semicolon expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (143, 8)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (143, 8)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (144, 5)
'=' - assignment expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (144, 3)
',' - semicolon expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (144, 5)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (144, 5)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (145, 5)
'=' - assignment expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (145, 3)
',' - semicolon expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (145, 5)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (145, 5)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (146, 5)
'=' - assignment expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (146, 3)
',' - semicolon expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (146, 5)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (146, 5)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (148, 5)
'=' - assignment expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (148, 3)
',' - semicolon expected C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (148, 5)
',' - unexpected token C:\Program Files\Deltabank Trader 4\experts\test5.mq4 (148, 5)

Have you declared them globally outside your function? Yes and put commas instead ; Surely you haven't changed the commas to semicolons...
 

Citizens!

Can you tell me how to access data outside the chart window in the Expert Advisor?

The problem is that, for example, if the maximum number of bars in the window is set to 300, then:

1.Function iBarShift("EURUSD",60,TimeBar,false) stubbornly does not want to give values greater than 300 at any value of "TimeBar".

2. iOpen("EURUSD",60,i) gives zeros if i>300.

etc.

Is there any way to overcome this?

 

Please give me the code of function that will put a stop once at breakeven level, when the profit will be for example 20 pips.

Thanks in advance for the reply:)

Reason: