Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 540

 
sannin:

Help if you don't mind

to teach an Expert Advisor to trade by the indicator

BS_Living Now ver #1.mq4 https://www.mql5.com/ru/code/11014#50910

UP= iCustom(Symbol(),NULL,"Now",BQuant,0,0);

DOW= iCustom(Symbol(),NULL,"Now",BQuant,1,0);


if(DOW){OrderSend(Symbol(), OP_SELL, Lot, Bid, Slip, 0, 0, "Forex-Robots.ru SELL", Magic, 0,Red);}


if(UP ){OrderSend(Symbol(), OP_BUY, Lot, Ask, Slip, 0, 0, "Forex-Robots.ru BUY", Magic, 0,Blue);}


Comment

(

"\n Profit: ", UP,

"\n Profit: ", DOW

);

I tried to read the values in the comment but they are always static.

The indicator name should be "BS_Living Now ver #1"
 

Yes, I have an indicator under the name Now in the folder

I put the values in the comment to see how the numbers change but they are static in the tester as well as live and they are not zero

 
sannin:

Yes, I have an indicator under the name Now in the folder

I posted the values in the comment to see how numbers change and they are static, both in the tester and in real life and they are not zero.


If it is similar to a fractal, its value should be searched for in the history, but not on the zero bar.

Z.I.: That's right, it starts calculations from bar #1, it makes no sense to look for something on zero bar...

 

Can you advise how to add to an EA the function to close all orders if the distance between market price and the furthest order price exceeds 1000 pips for example?

 
evillive:

If it is similar in principle to fractals, then it makes sense to look for its value further in history, but not at zero bar.

Z.I.: That's right, it starts calculations from bar 1, it makes no sense to look for something on the zero bar...

From bar #2 by code, Extrim_Detect(s+1);
 
AlexeyVik:

And accordingly the condition

Thank you Alexey. I've done everything as you recommended.

extern int    Min_iMA_OpenDistance   = 60;
extern int    Max_iMA_OpenDistance   = 85; 

changed entry condition

int GetSignal()
{
  int Signal = 0;

  double iMA_Signal = iMA(Symbol(), 0, iMA_Period, 0, MODE_SMMA, PRICE_CLOSE, 0);
  
  int Ma_Bid_Diff = MathAbs(iMA_Signal - Bid)/vPoint;
  
  if(Ma_Bid_Diff > Min_iMA_OpenDistance && Ma_Bid_Diff < Max_iMA_OpenDistance && Bid > iMA_Signal) Signal = -1;
  if(Ma_Bid_Diff > Min_iMA_OpenDistance && Ma_Bid_Diff < Max_iMA_OpenDistance && Bid < iMA_Signal) Signal = 1;
  
  return(Signal);
}

However, after making the changes the compiler "swears" at the following line

iMA_OpenDistance  *= DcD; 

iMA_OpenDistance' - undeclared identifier - not declared identifier. I've read the tutorial and help on identifiers but nothing works. Can you tell me where I went wrong and how to fix it?

 
tatianati:

Thank you Alexey. I did as you recommend.

Changed input condition

However, after making the changes, the compiler "swears" at the following line

iMA_OpenDistance' - undeclared identifier. I've read my tutorial and help on identifiers, but nothing works. Can you tell me where I went wrong and how to fix it?

Apparently we will have to use the powers of telepathy.

First there was only iMA_OpenDistance, then it was divided into 2 variables Min_iMA_OpenDistance and Max_iMA_OpenDistance, so the iMA_OpenDistance variable is left undeclared.

You don't need to change the values of external variables. It is better to declare an additional variable and do whatever you want with it.

As I understand it, the variable vPoint is Point*10. Accordingly Ma_Bid_Diff is the distance from Bid to the MA in 4-digit points. And DcD is what? My telepathic abilities are not enough. But anyway, it seems to me that iMA_OpenDistance *= DcD; is unnecessary. Or is this a conversion to 5 digit points? What for?

 
AlexeyVik:

Apparently we will have to use telepathy.

At first there was only iMA_OpenDistance then it was divided into 2 variables Min_iMA_OpenDistance and Max_iMA_OpenDistance, so the variable iMA_OpenDistance is left undeclared.

You don't need to change the values of external variables. It's better to declare an additional variable and do whatever you want with it.

As I understood the vPoint variable is Point*10. Accordingly Ma_Bid_Diff is the distance from Bid to the MA in 4-digit points. What is DcD? My telepathic abilities are not enough. But anyway, it seems to me that iMA_OpenDistance *= DcD; is unnecessary. Or is this a conversion to 5 digit points? What for?



Alexey, you really are a telepath, it's really a 5-digit translation. Thank you for the clarification and how I failed to grasp Min_iMA and Max_iMa instead of iMa. Thanks again.

P.S. If you open a telepathic course, I'll be the first to sign up :-)

 

Maybe someone has such an advisor.

1. opens two different buy and sell orders simultaneously

2. when one of them closes on profit . it opens two different buy and sell orders again, etc.

If you do not have to do anything with losing orders, it seems to be quite simple . maybe somebody will be able to write it for you? i would be very grateful to you!

 

Good afternoon.

Is there any physical meaning to dividing the fast ATR by the slow ATR?

or what do we get as a result?

Why do I ask - I have seen such an indicator

Reason: