stringo wrote:
What about following lines?
===
18:46:13 period_converter EURUSD,H1: loaded successfully
18:46:38 period_converter EURUSD,H1: 1534 record(s) written
18:47:42 period_converter EURUSD,H1: Chart window detected
===
Period converter must detect a chart opened offline
Test script attached to the offline chart
===
18:48:22 test_script EURUSD,H3: loaded successfully
===
In this case EURUSD,H3
============================
OK. I have an offline H1 chart of the EUR USD loaded. I compiled your script, but
it still reads the most current bid/ask. Here is the log.
This is from Андрей Хатимлянский who graciously provided this.
Hello guys,
i just created an EA based on the above code. But when the EA opens a position, a message appears at the Experts tab console, saying that the EA initialized. After that, the EA is dead and nothing else can be executed.
For what it's worth, I use this in the EA I created for offline Renko charts... :-)
This will allow MT4 to kill the EA if needed, and will also stop the EA if you turn off "Experts Allowed" in your MT4 app.
voidOnInit() {
// Perform init stuff here...
// Since we are running in an offline chart, we must manually call OnTick() and run a forever while() loop inside of that.OnTick();
return;
}
voidOnTick() {
while (!IsStopped()) {
if (!IsExpertEnabled()) { break; }
//---- Only go trading on the beginning of a NEW bar/candle.if (isNewBar()) {
journalString = StringConcatenate(alertPrefix, "New bar! Time: ",Time[0]);
Print(journalString);
checkForTrades();
}
}
// Sleep for 100ms so we don't kill the CPUSleep(100);
}
}
void checkForTrades() {
// Code for checking if you should place an order or exit an order goes here...
}
For what it's worth, I use this in the EA I created for offline Renko charts... :-)
This will allow MT4 to kill the EA if needed, and will also stop the EA if you turn off "Experts Allowed" in your MT4 app.
Just two points. More than 6 months there has been OnTimer event handler, so no need for loops in OnTick() or OnInit(). The other point is that you can test only a strategy based on a standard OnTick event.
So better to chose such an offline chart that does not require workarrounds.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Period_converter script refreshes my offline H3 chart by PostMessage function.
And what script or expert refreshes your offline H1 chart?
What about following lines?
===
18:46:13 period_converter EURUSD,H1: loaded successfully
18:46:38 period_converter EURUSD,H1: 1534 record(s) written
18:47:42 period_converter EURUSD,H1: Chart window detected
===
Period converter must detect a chart opened offline
Test script attached to the offline chart
===
18:48:22 test_script EURUSD,H3: loaded successfully
===
In this case EURUSD,H3
07:07:45 hist_Test EURUSDm,H1: loaded successfully
07:07:45 hist_Test EURUSDm,H1: bid = 1.2559 ask = 1.2561
07:07:45 hist_Test EURUSDm,H1: bid = 1.2559 ask = 1.2561
The script has stopped by itself.
This is from Андрей Хатимлянский who graciously provided this.
How can I add custom indicators in this script to check last bars to verify sell or buy?
Thank in advance!
This is from Андрей Хатимлянский who graciously provided this.
Hello guys,
i just created an EA based on the above code. But when the EA opens a position, a message appears at the Experts tab console, saying that the EA initialized. After that, the EA is dead and nothing else can be executed.
I would appreciate any help
Thank you
For what it's worth, I use this in the EA I created for offline Renko charts... :-)
This will allow MT4 to kill the EA if needed, and will also stop the EA if you turn off "Experts Allowed" in your MT4 app.
For what it's worth, I use this in the EA I created for offline Renko charts... :-)
This will allow MT4 to kill the EA if needed, and will also stop the EA if you turn off "Experts Allowed" in your MT4 app.
Just two points. More than 6 months there has been OnTimer event handler, so no need for loops in OnTick() or OnInit(). The other point is that you can test only a strategy based on a standard OnTick event.
So better to chose such an offline chart that does not require workarrounds.