How to code? - page 127

 
:: you can't use "property" in a code, just use "color" to a normal variable name in your if statement. like... color indic.1=Lime
:: then use the color outcome in a SetIndexStyle() (look this up in you manual) but will be like...
SetIndexStyle(0,DRAW_LINE,0,0,indic.1);
:: put all of this in your init() function

:: check in your manual where & how the #property must be placed, they have different aspects to consider.

IN10TION

 

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?

 
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

Dave

 
#property indicator_color1 Magenta

#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!

Reason: