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

 
granit77:
The author does not know the essence of the result he is looking for. The author wants to see what happens :))
In simplified form it is a problem to express the numerical position of a point on the segment, where all distances are known. What is also known is that finding a point in the middle of the segment - the balance position, nothing happens. Closer to the upper boundary is a positive increment, closer to the lower boundary is a negative increment. As a hypothesis. And all variants are accepted. Even upside down.


Victor, you don't know anything!

If he wants to see what comes out of it, let him let me see how it went in :)

imho, everything else in the post I quoted is fiction, such as:

1. finding a point in the middle of the segment - the balance position

2. nearer to the upper limit - positive increment

3. closer to the lower boundary - negative.

4. any variants are acceptable

Variants of what?

 
splxgf:

Sort by value and select first/last... Although there is a less costly option of a direct search.

How are the values stored?


They appear gradually over the course of the day.
 
artmedia70:

If there is an array of values, then:

int ArrayMaximum( double array[], int count=WHOLE_ARRAY, int start=0)
Search for the element with the maximum value. The function returns the position of the maximum element in the array.
Parameters:
array[] - Numeric array to search in.
count - Number of elements to search.
start - The start index for the search.
Example:

Thank you!
 
I am thinking about 1) verification of an open position and stop loss slippage, and 2) checking the stop loss in a real position.

I myself suggest 1) to check the open position for slippage of stop loss. If the value of floating balance is greater than stop loss, close it immediately.

2) Additional checking of stop loss and take profit setting.

3) Not to open positions at the weekend because of the appearing ticks.

What else needs to be added to the code, for a real EA?
 
001:

They appear gradually over the course of the day.

If it is an array of timeseries, you can use https://docs.mql4.com/ru/series/iHighest.

 
CLAIN:

Here's a simple function for me:

I want my function to return only the maximum value of "i", how do I do that?

int numberI()
    {
      int a;
      for(int i=1;i<5;i++)
      {
         if(CTicketArray[i]!=0)
         {   
            Print(i);
              a=i;
         }   
        
      }
    }
Your number is "a".
 
ire9589:
I am thinking about 1) verification of an open position and stop loss slippage, and 2) checking the stop loss in a real position.

I myself suggest 1) to check the open position for slippage of stop loss. If the value of float balance is greater than stop loss, close it immediately.

2) Additional checking of stop loss and take profit setting.

3) Not to open positions at the weekend because of the appearing ticks.

What else needs to be added to the code, for a real EA?

You do not need to add them to the code, but to the trading system. If it will work with the positive expected payoff, the question of what else should be added to the code will not arise - everything will be crystal clear.
 
Hello. Could you please tell me. What price to use for trading functions of other pairs ( not on the one the EA is attached to). I was thinking about iClose, I wondered. Are the Bid values stacked there, I guess?
 
nadya:
Hello. Could you please tell me. What price to use for trading functions on other pairs ( not on the one the EA is attached to). I was thinking about iClose, I wondered. Are the Bid values stacked there, I guess?

double bid   =MarketInfo("EURUSD",MODE_BID);
double ask   =MarketInfo("EURUSD",MODE_ASK);
double point =MarketInfo("EURUSD",MODE_POINT);
int    digits=MarketInfo("EURUSD",MODE_DIGITS);
int    spread=MarketInfo("EURUSD",MODE_SPREAD);
 
drknn:

Thank you, it turned out to be quite simple)