You could either write the price as a comment then move it to each order until such time as you want to change it, use a global variable or write to file.
Trying to get swing high/low code to work on patterns other than pins
Hi,
I have an EA that calls an indicator which tells me if the price is at a swing high/low. It works fine on the current bar, so for e.g if its a pinbar and its at a swing high/low then my EA creates a buy/sell entry. Its works great as long as my EA picks up pinbars. But its no good if I need to make the entry on say an inside bar at a swing high/low because the high/low bar as passed.
This code will work for the close of the first bar but I need the code to work for close of the second or third. In other words I need a way for my EA to remember that the price is at the high/low for a few bars after the high/low.
luxinterior: instead of having startcolor as a string have it as a color Lux
Lux, It would work this way if I had only one indicator color to change (example from red to green), but I have two indicator colors to change dependent on condition change: Condition 1 to Condition 2 of Indicator:
Bool Condition 1 = True: Indicator A color = Yellow //UP Direction - Buffer 2
Bool Condition 1 = True: Indicator B color = Clr_NONE - Buffer 3
Bool Condition 2 = False: Indicator A color = Clr_NONE - Buffer 2
Bool Condition 2 = False: Indicator B color= Magenta //Down Direction - Buffer 3
Lux, How do I resolve this then??
Anxiously awaiting your reply! And Thanks for responding
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.
Thanks, I think I can try this.
Dave
<<<
EA with Close by time and day
Hi coders
i have try to create a EA with followin options:
Start by selected Hours and Time.
It seems as if this function is working.
The other option i like to have is:
Close all trades at selected Hour an Time.
Please see my EA-Template, that i have wrote.
Somebody can help an old man?
Locking in first initial value of OrderOpenPrice()
Does anyone know of a way to lock in the first occurrence of the value of OrderOpenPrice()?
for example double x=OrderOpenPrice(); but I never want the values to change
upon sale of the order or renewing the order
I need x to act as a reference point
any help greatly appreciated
thankyou
You could either write the price as a comment then move it to each order until such time as you want to change it, use a global variable or write to file.
Lux
Trying to get swing high/low code to work on patterns other than pins
Hi,
I have an EA that calls an indicator which tells me if the price is at a swing high/low. It works fine on the current bar, so for e.g if its a pinbar and its at a swing high/low then my EA creates a buy/sell entry. Its works great as long as my EA picks up pinbars. But its no good if I need to make the entry on say an inside bar at a swing high/low because the high/low bar as passed.
This code will work for the close of the first bar but I need the code to work for close of the second or third. In other words I need a way for my EA to remember that the price is at the high/low for a few bars after the high/low.
(prevtime != Time[0])
{
DeleteSellLimit();
}
prevtime = Time[0];
instead of having startcolor as a string have it as a color
Lux
I would like to know,can we code using chinese or arabic font inside indicator and the text will be show on the chart?
instead of having startcolor as a string have it as a color Lux
Lux, It would work this way if I had only one indicator color to change (example from red to green), but I have two indicator colors to change dependent on condition change: Condition 1 to Condition 2 of Indicator:
Bool Condition 1 = True: Indicator A color = Yellow //UP Direction - Buffer 2
Bool Condition 1 = True: Indicator B color = Clr_NONE - Buffer 3
Bool Condition 2 = False: Indicator A color = Clr_NONE - Buffer 2
Bool Condition 2 = False: Indicator B color= Magenta //Down Direction - Buffer 3
Lux, How do I resolve this then??
Anxiously awaiting your reply! And Thanks for responding
Dave
#property indicator_color2 Yellow
extern bool TrendDirectionUp=true;
string Color1;
string Color2;
int init() {
if(TrendDirectionUp==true){
Color1=Yellow;
Color2=CLR_NONE;
}
if(TrendDirectionUp==false){
Color1=CLR_NONE;
Color2=Magenta;
}
SetIndexStyle(0,DRAW_ARROW,0,star_size,Color1);
SetIndexStyle(1,DRAW_ARROW,0,star_size,Color2);
SetIndexArrow(0,172);//333
SetIndexArrow(1,172);//334
SetIndexBuffer(0,b1);
SetIndexBuffer(1,b2);
return(0);
}Right now, both Color(s) 1 & 2 show 'black' on the graph!!
Can any expert Guru help me solve this issue???
Thanks in Advance!