EA Trading bot with indicator
EA Trading bot with indicator
Loading saved threads...
ABOU-YOUSSEF EL Mehdi · External communityPost link
External question — Stack Overflow Stack Exchange
Author: ABOU-YOUSSEF EL Mehdi
Original post: https://stackoverflow.com/questions/57478825
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I'm currently trying to build a trading Bot works with an indicator, I'm using the MQL5 language to build it .
I'm using the ichimoku indicator.
How to retrieve the value of every line of the indicator (base line, conversion line, the lagging line and the line A and B of the cloud) of a specific Bar on a timeframe for example:
(Timeframe H1
Bar : 2019/08/08 - 10:00 a.m
Symbol : EURUSD
▪︎base line : 1.1250
▪︎conversion line : 1.4050)
and so on for the other lines ...
I hope I made my question clear enough.
Quote
Report
Boyka Smith · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: Boyka Smith
Original post: https://stackoverflow.com/a/78517810
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
In MQL5, indicator values are stored in buffer.So use CopyBuffer(...) function to get values.
I have also used Ichimoku indicator, this function works well.
I will give you the code I used.
int IchimokuRes;
double SenKouA[], SenKouB[];
OnInit(){
IchimokuRes = iIchimoku(_Symbol, PERIOD_H1, 9, 26, 52);
}
OnTimer(){
CopyBuffer(IchimokuRes, 1, 0, 1, SenKouA);
CopyBuffer(IchimokuRes, 2, 0, 1, SenKouB);
double curSenKouA = SenKouA[0], curSenKouB = SenKouB[0];
}
You can find other lines by changing the second parameter in CopyBuffer(...).
If you follow me, you will achieve the goal.
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External answer — Stack Overflow Stack Exchange Author: Boyka Smith Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/a/78517810 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. In MQL5, indicator values are stored in buffer.So use CopyBuffer(...) function to get values. I have also used Ichimoku indicator, this function works well. I will give you the code I used. int IchimokuRes; double SenKouA[], SenKouB[]; OnInit(){ IchimokuRes = iIchimoku(_Symbol, PERIOD_H1, 9, 26, 52); } OnTimer(){ CopyBuffer(IchimokuRes, 1, 0, 1, SenKouA); CopyBuffer(IchimokuRes, 2, 0, 1, SenKouB); double curSenKouA = SenKouA[0], curSenKouB = SenKouB[0]; } You can find other lines by changing the second parameter in CopyBuffer(...). If you follow me, you will achieve the goal.
Checking account access…