Questions from Beginners MQL4 MT4 MetaTrader 4 - page 78

 
If you can set the minimum and maximum of the indicator window using the function IndicatorSetDouble(INDICATOR_MAXIMUM / INDICATOR_MINIMUM, double_value), then how can you remove this value by setting a default state, when there is no limit?
It is necessary for the case when minimum and maximum of the indicator on different timeframes are different, and on some timeframes the limit is not necessary, because these times are just not used...
 
Taras Slobodyanik:


If it is used for an indicator, it should work
If for an EA, the events do not come in the tester (for Expert Advisors) and the timer does not work ...

If it works in the tester, then the panel is drawn differently - ask objects (have changed / moved) and redrawn as necessary, react to clicks...
Also, emulate the timer, if necessary.


Got it all figured out.

Another question about visualisation. The Expert Advisor opens trades by itself. When I run it in the Strategy Tester, it also opens deals, but virtual ones. Everything is OK here. But when I run it in the Strategy Tester. The trades stop. Can we make our EA open trades and record them in the journal during visualization of the testing process?


The timer is not used in the Expert Advisor.

 
VladPro77:


Thank you, but not quite the same)

I describe the following situation.

1. The timeframe ended, a candle was formed. The indicator is recalculated, it is drawn.

2. A new timeframe starts.( There is nonew candle until its end). Bid and Ask change during this timeframe.

I want to react to these price changes (during the current timeframe, the candle is not formed yet).

It's not even a question of drawing the charts, but of fixing the moment by a condition. I want to receive an alert as soon as the stochastics have crossed (we have three hours left till the end of the timeframe and the condition is fulfilled now).

And the chart can be drawn when the timeframe ends.

I do not understand anything. I do not understand anything. What prevents me from calculating on every incoming tick?
 
Rustem71:

Another question about visualisation. The Expert Advisor opens trades by itself. When I run it in the Strategy Tester, it also opens deals, but virtual ones. Everything is OK here. But when I run it in the Strategy Tester. The trades stop. Is it possible to make our Expert Advisor open trades and record them in the journal during visualization of the testing process?

Well, all operations are anyway written in the Result and Journal tabs
 
Rustem71:
I do not understand anything. I would like to ask therefore. What prevents me from entering the calculation at every incoming tick?


I myself am confused)).

Is the last candle on the chart the current (unfinished) time series candle, or the previous one?

If it is the current one and its parameters change with every tick, then the question is solved

 
Taras Slobodyanik:
You can see all operations in the Result and Journal tabs


The thing is that if you enable the visualization, the orders stop opening. Therefore, they are not being written anywhere. I do not know how to open them in the tester.

Try to run any trading Expert Advisor in the Strategy Tester and then run it in visualisation mode without changing anything. In the second case trades will not open.

 
Good day! Can you please tell me how to open a singlepending order?
How do I stop the loop if I need to open one SELLSTOP while BUY is open?

It opens a bunch for me until the deposit runs out!

Thanks in advance!

 
Akinak:
Good day! Can you please tell me how to open a singlepending order?
How do I stop the loop if I need to open one SELLSTOP while BUY is open?

It opens a bunch for me until the deposit runs out!

Thanks in advance!


You go through all of the existing orders, with a check on the deal type, on the symbol, etc. If you don't have the right one, you open it otherwise you exit.
 
Rustem71:

You go through all existing orders, checking for trade type, symbol, etc. If the right one is not there, you open otherwise exit.
Please take a look at it! If you can explain what I did wrong! As only I have not tried or does not open an order or opens a bunch on the cycle!!!
Files:
888.mq4  9 kb
 
Akinak:
Please, take a look at this! If you can explain what I did wrong! I tried everything, it either does not open an order or opens a bunch in a loop!


Write what you want to do on the arrival of the tick???

There's so much extra work you're doing.

And write the code correctly, don't abbreviate brackets. If you are supposed to write curly brackets in the condition, you should write them. It will be easier to understand the code. When you get the hang of it, you may start abbreviating.

I'm waiting for clarifications on the tick.

Reason: