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

 
TarasBY:
First, decide: What will you do if there is no profit in the morning?! (Unless, of course, it's "when the profits are there in the morning")... :)))))))

I told you that I tested it, there is profit there anyway. My settings are not standard. It should be so that it reaches 3 am, it waits for take profit and turns off the EA.
 
SpikeOne:

I have already written that I tested it, there is profit there anyway. My settings are not standard. And it should be so that it reaches 3 am, it waits for take profit and shuts down the Expert Advisor.

In terms of programming logic, this is absurd.

There is a possibility of such an outcome. Therefore, it must be foreseen. Otherwise, you may get an undefined situation, in which, for example, you may lose your deposit.

 
Zhunko:

In terms of programming logic, this is absurd.

There is a possibility of such an outcome. Therefore, it must be foreseen. Otherwise, there may be an undefined situation in which, for example, a deposit is lost.


If you are a Martin, there is always a possibility of losing the deposit. Is it possible to do this without considering that this is absurd? Can you at least show me that place in the code where orders are closed at take profit, so that I have something to start with?
 
SpikeOne:

If you are a Martin, there is always the possibility of losing the deposit. Can you at least show me the place in the code where orders are closed at take profit, so that I have something to start with?

You can, of course! The right programmer will take all cases into account.

 

Who can tell me why I can't load MT4? Presenting a screenshot of the error.


 
SpikeOne:

There is always a possibility of losing the deposit on a martin, is it even possible to do this without considering that it is absurd? Can you at least show me the place in the code where orders are closed at take profit, so that I have a good start?


On a martin, there is always a probability of getting the expected profit from take profit of the first lot. And if you are unlucky, you will either run out of deposit or exceed the maximum allowable lot size.

And is it worth risking so much money to win back the initial bet? Especially since Murphy's Laws have never been abolished..... And it's not absurd, it's just practical life, not theoretical))

 
If it's possible, maybe you can help me run the tests, and I can prove that the program works with my initial data and on tests.
 

Good day again!) The previous problems with closing have been solved, but new questions have appeared. The essence of the question is how to compare the current indicator readings (particularly MACD) on zero bar with the readings of the same indicator on the first and second bar (i.e. the previous ones). I don't really understand how to do it, so I will be very grateful for any help)))

 
ElhoroS:

Good day again!) The previous problems with closing have been solved, but new questions have appeared. The essence of the question is how to compare the current indicator readings (particularly MACD) on zero bar with the readings of the same indicator on the first and second bar (i.e. the previous ones). I don't really understand how to do it, so I will be very grateful for any help)))

   double macd_1=iMACD(Symbol(),Period(),fast_ema,slow_ema,signal,PRICE_CLOSE,1); // макдак на первом баре
   double macd_2=iMACD(Symbol(),Period(),fast_ema,slow_ema,signal,PRICE_CLOSE,2); // макдак на втором баре
On the zero bar the indicator data will not be fixed. At every tick, in fact, will change, because the zero bar has not yet been formed. Therefore, the data will be taken from the first bar. If you want to take it from the zero bar, then change PRICE_CLOSE to PRICE_OPEN - this is the only price that does not change on the zero bar, but the indicator will slightly differ from its standard representation - just a little.
 
artmedia70:
At the zero bar the indicator data will not be fixed. It will practically change on every tick, as the zero bar has not yet been formed. Therefore, take data starting from the first bar. If you want to take it from the zero bar, then change PRICE_CLOSE to PRICE_OPEN - this is the only price that does not change on the zero bar, but the indicator will slightly differ from its standard representation - just a little.
Thank you very much. It turns out to be simple, but it was imagined by voluminous operations with buffers))))
Reason: