Ask! - page 92

 

Date Expiry Code

ANCOLL:
Dear all trader,

I want to know how to put an expiration date in indicator or EA, so that it has an expiration days like picture below. What string code should be added in .mtq?

Thanks in advance.

Hi ANCOLL

Good to hear from you again, I have just got back from the Christmas holidays and am ready to get back into it. I use this code I hope you find it works for you.

string Message="";

datetime expire = D'2008.02.04 12:00';

if (TimeCurrent()>expire){

Alert("Trial has ended. Please contact xxxx @ xxxx.com");

return(0);

}else {Message="Price Display Activated";}

ObjectDelete("Price_Account_Info");

ObjectCreate("Price_Account_Info", OBJ_LABEL,WindowFind("Price"), 0, 0);

ObjectSetText("Price_Account_Info",""+Message+" - Expires "+TimeToStr(expire)+"",8, "Tahoma", ForestGreen);

ObjectSet("Price_Account_Info", OBJPROP_CORNER, 3);

ObjectSet("Price_Account_Info", OBJPROP_XDISTANCE, 5);

ObjectSet("Price_Account_Info", OBJPROP_YDISTANCE, 5);

This code puts a message into the indicator window or chart window and an expiry into an Alert Box

This example puts a message into the indicator window or chart window and an expiry into the top left of the chart

datetime expire = D'2008.02.04 13:25';

if (TimeCurrent()>expire){

Comment("Trial has ended. Please contact xxxx @ xxxx.com");

return(0);

}else {Message="Price Display Activated";}

ObjectDelete("Price_Account_Info");

ObjectCreate("Price_Account_Info", OBJ_LABEL,WindowFind("Price"), 0, 0);

ObjectSetText("Price_Account_Info",""+Message+" - Expires "+TimeToStr(expire)+"",8, "Tahoma", ForestGreen);

ObjectSet("Price_Account_Info", OBJPROP_CORNER, 3);

ObjectSet("Price_Account_Info", OBJPROP_XDISTANCE, 5);

ObjectSet("Price_Account_Info", OBJPROP_YDISTANCE, 5);

This next example puts both the messages into Comments on the top left of the chart.

datetime expire = D'2008.02.04 13:25';

if (TimeCurrent()>expire){

Comment("Trial has ended. Please contact xxxx @ xxxx.com");

return(0);

}else {Comment("Price Display Activated");}

All of these codes make the indicator disappear when the expiry time is up

A simple indicator as an example posted below

price_display.mq4

cja

Files:
comment.gif  68 kb
comment1.gif  85 kb
 

Code - Disable EA on Friday's morning

Can someone help me with a piece of code which disable operation of EA exactly on Friday's morning, 8:00?

Thanks in advance,

Warren

 

Thanks cja for the code,

I am glad that you are always around to help

God bless..

 
if(DayOfWeek()==5 && TimeHour(TimeCurrent())==8) return(0);

put this line into the start() function and before any line fo code!

Warren:
Can someone help me with a piece of code which disable operation of EA exactly on Friday's morning, 8:00?

Thanks in advance,

Warren
 

Hello

i want to ask, how to unite all indicators and template to become one indicators ?

..

example :

i have this indicators in one single chart windows

1.bband stop

2.bolinger squeze

3.wcci

4.fibopiv

and i already made Template for all this indicators

--------------------

and i want to combine it all to become 1 indicator, so just 1 indicator that have all that stuffs, can i do it ??

can someone help me ??

thank you very much

 
codersguru:
if(DayOfWeek()==5 && TimeHour(TimeCurrent())==8) return(0);
put this line into the start() function and before any line fo code!

Thanks a lot for Your help! It works fine!

Could You be so kind to post a simple piece of code which disable operation of EA on definite month - September?

I'm not a programmer and that's why I ask for Your advice

 

Hello

Im new to this forum, and have a question. I'm using this indicator and it seems to be programed crappy, I have to update every bar and i guess is just annoying to me lol would anybody be willing to take a look at it, and maybe shape it up a bit for me thank you for your time.

Files:
 

Hi Sendra,

Thanks again for your help. I've been playing with iHigh and iLow but you sure use it differently than I was going to. I've copied it and will check it out as soon as I have a chance. I'm sure it will work out fine but I will need to put my thinking cap on this old and grey head of mine to see if I can put it together.

I will let you know how I made out with it

Thanks again,

Putz

 

How to show currency spread from indicator??

#property indicator_chart_window

double spread=Ask-Bid;

{

ObjectCreate("Spread_Label", OBJ_LABEL, 0, 0, 0);

ObjectSetText("Spread_Label", DoubleToStr(spread,0), 14, "Ariel", Yellow);

ObjectSet("Spread_Label", OBJPROP_CORNER, 3);

ObjectSet("Spread_Label", OBJPROP_XDISTANCE, 50);

ObjectSet("Spread_Label", OBJPROP_YDISTANCE, 55);

}

I tried this but get a big '0' value on the graph. How do I get the indicator to place the spread on the graph of the currency it is being overlayed on?

Your wisdom and knowledge is needed!

Dave

 

DIN V3

i notice that, Pivot text is not update everyday ??

always need to refresh it...

what is the solution ??

i use it with others indicators in 1 chart windows

thanks

Reason: