My EA identieifes certain trigger bars, I want a very simple arrow to be drawn above these bars. The code for arrows used in indicators seem quite complicated, is there not an easier way?
E.g. if previous bar close higher than bar before that I want to draw an arrow
if (NEWBAR)
if iClose(NULL,0,1) > iClose(NULL,0,2)
"DRAW ARROW ABOVE BAR 1"
Can anyone help with easy code to do this?
void DrawArrowUp(string ArrowName,double LinePrice,color LineColor) { ObjectCreate(ArrowName, OBJ_ARROW, 0, Time[0], LinePrice); //draw an up arrow ObjectSet(ArrowName, OBJPROP_STYLE, STYLE_SOLID); ObjectSet(ArrowName, OBJPROP_ARROWCODE, SYMBOL_ARROWUP); ObjectSet(ArrowName, OBJPROP_COLOR,LineColor); } void DrawArrowDown(string ArrowName,double LinePrice,color LineColor) { ObjectCreate(ArrowName, OBJ_ARROW, 0, Time[0], LinePrice); //draw an up arrow ObjectSet(ArrowName, OBJPROP_STYLE, STYLE_SOLID); ObjectSet(ArrowName, OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN); ObjectSet(ArrowName, OBJPROP_COLOR,LineColor); }
f.e. if iClose(NULL,0,1) > iClose(NULL,0,2) DrawArrowUp("Up"+Bar,Close[1]+10*Point,Lime);
if you draw more often on the same bar i would recommend to check first if the arrow already is existing on the chart and delete existing or set new values only...
Thanks so much EADeveloper!
Two problems:
1. Can I shift the arrow one bar to the left, i.e. on bar 1 not bar 0?
2. It seems to only draw the arrow the first time the condition is met, if conditions are met again a few bars later I get no arrow?
Two problems:
1. Can I shift the arrow one bar to the left, i.e. on bar 1 not bar 0?
2. It seems to only draw the arrow the first time the condition is met, if conditions are met again a few bars later I get no arrow?
1 yes, change Time[0] to Time[1]
2 sorry ... DrawArrowUp("Up"+Bars,Close[1]+10*Point,Lime); i forgot the s from Bars before ...
Both problems solved, thank you again!
//how i can use the Arrow ?
//for example:
//vline:
void DrawVline8()
{
//Delet the last line
ObjectDelete(_Symbol,"Line"[8]);
//create a line object
ObjectCreate(_Symbol,"Line"[8],OBJ_VLINE,0,TimeCurrent(),0);
//set the object color
ObjectSetInteger(0,"Line"[8],OBJPROP_COLOR,clrYellow);
//set the object width
ObjectSetInteger(0,"Line"[8],OBJPROP_WIDTH,4);
}
if
(A==1)
{
DrawVline8() ;
}
//this is for vertical line
//But
-
Don't Hijack other threads for your off-topic post. Next time, make your own, new, thread.
-
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum (2019.05.06)
Messages Editor -
Don't post code that will not even compile: "Line"[8] is babel.
-
You need it for an arrow, change it to an arrow.
-
MT4: Learn to code it.
MT5: Begin learning to code it.If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.
-
or pay (Freelance) someone to code it. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum (2019.08.21)
We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
No free help (2017.04.21) -
//how i can use the Arrow ?
//for example:
//vline:
void DrawVline8()
{
//Delet the last line
ObjectDelete(_Symbol,"Line"[8]);
//create a line object
ObjectCreate(_Symbol,"Line"[8],OBJ_VLINE,0,TimeCurrent(),0);
//set the object color
ObjectSetInteger(0,"Line"[8],OBJPROP_COLOR,clrYellow);
//set the object width
ObjectSetInteger(0,"Line"[8],OBJPROP_WIDTH,4);
}
//this is for vertical line
//But
-
Don't Hijack other threads for your off-topic post. Next time, make your own, new, thread.
-
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum (2019.05.06)
Messages Editor -
Don't post code that will not even compile: "Line"[8] is babel.
-
You need it for an arrow, change it to an arrow.
-
MT4: Learn to code it.
MT5: Begin learning to code it.If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.
-
or pay (Freelance) someone to code it. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum (2019.08.21)
We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
No free help (2017.04.21 -
This program has no problems running
If you can not help, do not throw stones
I am using the same program in Expert.
And this is just an example of a vertical line.
I need to use َArrow like this.
I wrote the complete program and only show the signals with a line.
I want to show it with an arrow now.
If you can conditionally run a program to draw the up and down arrow. If you do not know, let other people comment.
entire.
This program has no problems running
If you can not help, do not throw stones
I am using the same program in Expert.
And this is just an example of a vertical line.
I need to use َArrow like this.
I wrote the complete program and only show the signals with a line.
I want to show it with an arrow now.
If you can conditionally run a program to draw the up and down arrow. If you do not know, let other people comment.
entire.
you can look this.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
My EA identieifes certain trigger bars, I want a very simple arrow to be drawn above these bars. The code for arrows used in indicators seem quite complicated, is there not an easier way?
E.g. if previous bar close higher than bar before that I want to draw an arrow
if (NEWBAR)
if iClose(NULL,0,1) > iClose(NULL,0,2)
"DRAW ARROW ABOVE BAR 1"
Can anyone help with easy code to do this?