• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 4:12pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 4:12pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

How to remove the automatic expiration of MT4 alerts? 0 replies

How to remove the automatic expiration of MT4 alerts ? 2 replies

Help modifying code to work with 4 digit broker 1 reply

Need help modifying a pretty good Trend Indicator 3 replies

need help with expiration and timing code 0 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe

Need help modifying a code to include Automatic Expiration

  • Post #1
  • Quote
  • First Post: Apr 2, 2012 3:06am Apr 2, 2012 3:06am
  •  adeforex
  • Joined Aug 2008 | Status: Trading Live as a Professional Do | 381 Posts
Please , i am just learning to write mql language from the basics. i dont really know much for now.
i am trying to add code to some indicators so that it will expire automatically after 30days or 45 days of trial without me , interferring it all the time. this means any time it is being used, after 30 days (or 45 days,) it automatically expire and shows pop up alert like ' THE INDICATOR HAS EXPIRED, CONTACT [email protected] FOR FURTHER ASSISTANCE", just in a simple and easy way to protect it
but it is not just working and compliling as i have been doing it.
PLEASE CAN SOME ONE JUST ASSIST ME IN ITS SIMPLEST FORM,
1.THE CODE I WILL COPY AND PASTE ACCORDING TO WHAT I EXPLAINED
2. WHERE TO INSERT IT (ATTACHED IS 2 DIFFRENT INDICATORS SO THAT IT CAN BE OF HELP BY SHOWING the inserted codes IN DIFFRENT COLORS SO THAT I CAN GET IT ONCE AND FOR ALL.
I WILL REALLY APPRECIATE IT IF I GET ASSISTANCE,MATES

THE SAMPLE CODES, GETTING PROBLEMS FROM HIGHTED REGIONS
//+------------------------------------------------------------------+
//| |
//| |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_width1 3
#property indicator_width2 3

double CrossUp[];
double CrossDown[];
int CurrentTrend = 0;
int starttime = 0;
bool last_signal_down;
bool last_signal_up;

extern int BB_value = 14;
extern int Arrow_Pip_Distance = 100;
extern int Show_Alert = 1;
extern int Play_Sound = 1;
extern int Send_Mail = 0;
extern string SoundFilename = "alert.wav";

int init()
{
SetIndexStyle(0, DRAW_ARROW, EMPTY);
SetIndexArrow(0, 233);
SetIndexBuffer(0, CrossUp);
SetIndexStyle(1, DRAW_ARROW, EMPTY);
SetIndexArrow(1, 234);
SetIndexBuffer(1, CrossDown);
starttime = TimeLocal();

return(0);
}

int deinit()
{
Comment(" ");
return(0);
}

int start(if (TimeMonth(TimeCurrent()) >= 1 && validindicator == true)
{
Alert("The Indicator has expired");
validindicator=false;
}
if(validindicator == false)
{
return(0);
}) {

int limit, i, counter, loop;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1); //---- check for possible errors
if(counted_bars>0) counted_bars--; //---- last counted bar will be recounted

limit=Bars-counted_bars;

loop = 0;
for(i = 0; i <= limit; i++) {

double currbull = MathAbs(iBullsPower(NULL, 0, BB_value, 0, i));
double currbear = MathAbs(iBearsPower(NULL, 0, BB_value, 0, i));
double prevbull = MathAbs(iBullsPower(NULL, 0, BB_value, 0, i+1));
double prevbear = MathAbs(iBearsPower(NULL, 0, BB_value, 0, +i+1));


if (currbull>currbear && prevbull<prevbear)//ORDER ENTRY CONDITION LONG
{
CrossUp[i] = Low[i] - Arrow_Pip_Distance*Point;
last_signal_down=false;
last_signal_up=true;

if ((loop == 0) && (CurrentTrend != 1) && (TimeLocal() - starttime >= 10)) {
if (Show_Alert == 1) {
Alert("(M"+Period()+") "+Symbol()+" Bull-Bear Buy " + Hour()+":"+Minute()+" Ask: "+Ask);
}
if (Play_Sound == 1) {
PlaySound(SoundFilename);
}
if (Send_Mail == 1) {
SendMail("Bull-Bear MTF Buy " + Symbol() + " " + Hour()+":"+Minute()+" Ask: "+Ask+" (M"+Period()+")"," ");
}

CurrentTrend = 1;
}

if (loop == 0) {
loop = 1;
}
}
else
if (currbull<currbear && prevbull>prevbear)//ORDER ENTRY CONDITION LONG
{
CrossDown[i] = High[i] + Arrow_Pip_Distance*Point;
last_signal_down=true;
last_signal_up=false;

if ((loop == 0) && (CurrentTrend != -1) && (TimeLocal() - starttime >= 10)) {
if (Show_Alert == 1) {
Alert("(M"+Period()+") "+Symbol()+" Bull-Bear Sell " + Hour()+":"+Minute()+" Bid: "+Bid);
}
if (Play_Sound == 1) {
PlaySound(SoundFilename);
}
if (Send_Mail == 1) {
SendMail("Bull-Bear Sell " + Symbol() + " " + Hour()+":"+Minute()+" Bid: "+Bid+" (M"+Period()+")"," ");
}

CurrentTrend = -1;

}
if (loop == 0) {
loop = 1;
}
}
}
return(0);
}




ANOTHER PLAIN SAMPLE ONE WITHOUT ERROR

//+------------------------------------------------------------------+
//| |
//| |
//| |
//+------------------------------------------------------------------+
#property link ""

#property indicator_separate_window
#property indicator_buffers 4
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_color1 DimGray
#property indicator_style1 STYLE_DOT
#property indicator_color2 DimGray
#property indicator_color3 Lime
#property indicator_color4 Red
#property indicator_width3 2
#property indicator_width4 2



//---- input parameters
//
// nice setings for trend = 35,10,1
//
//

extern string note1 = "Stochastic settings";
extern int KPeriod = 30;
extern int Slowing = 10;
extern int DPeriod = 10;
extern string note4 = "0=sma, 1=ema, 2=smma, 3=lwma";
extern int MAMethod = 0;
extern string note5 = "0=high/low, 1=close/close";
extern int PriceField = 1;
extern string note6 = "overbought level";
extern int overBought = 80;
extern string note7 = "oversold level";
extern int overSold = 20;


//---- buffers
//
//
//
//
//

double KFull[];
double DFull[];
double Upper[];
double Lower[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+

int init()
{
SetIndexBuffer(0,DFull);
SetIndexBuffer(1,KFull);
SetIndexBuffer(2,Upper);
SetIndexBuffer(3,Lower);
SetIndexLabel(1,"Fast");
SetIndexLabel(2,NULL);
SetIndexLabel(3,NULL);

//
//
//
//
//

DPeriod = MathMax(DPeriod,1);
if (DPeriod==1) {
SetIndexStyle(0,DRAW_NONE);
SetIndexLabel(0,NULL);
}
else {
SetIndexStyle(0,DRAW_LINE);
SetIndexLabel(0,"Slow");
}

//
//
//
//
//

string shortName = "Stochastic ("+KPeriod+","+Slowing+","+DPeriod+","+maDescription(MAMethod)+","+priceDescription(PriceField);
if (overBought < overSold) overBought = overSold;
if (overBought < 100) shortName = shortName+","+overBought;
if (overSold > 0) shortName = shortName+","+overSold;
IndicatorShortName(shortName+")");
return(0);
}

//
//
//
//
//

int deinit()
{
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+

int start()
{
int counted_bars=IndicatorCounted();
int limit;
int i;




if(counted_bars<0) return(-1);
limit=Bars-counted_bars;

//
//
//
//
//

for(i=limit; i>=0; i--)
{
KFull[i] = iStochastic(NULL,0,KPeriod,DPeriod,Slowing,MAMethod,PriceField,MODE_MAIN,i);
DFull[i] = iStochastic(NULL,0,KPeriod,DPeriod,Slowing,MAMethod,PriceField,MODE_SIGNAL,i);

//
//
//
//
//

if (KFull[i] > overBought) { Upper[i] = KFull[i]; Upper[i+1] = KFull[i+1]; }
else { Upper[i] = EMPTY_VALUE;
if (Upper[i+2] == EMPTY_VALUE)
Upper[i+1] = EMPTY_VALUE; }
if (KFull[i] < overSold) { Lower[i] = KFull[i]; Lower[i+1] = KFull[i+1]; }
else { Lower[i] = EMPTY_VALUE;
if (Lower[i+2] == EMPTY_VALUE)
Lower[i+1] = EMPTY_VALUE; }
}

//
//
//
//
//

return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+

string priceDescription(int mode)
{
string answer;
switch(mode)
{
case 0: answer = "Low/High" ; break;
case 1: answer = "Close/Close" ; break;
default: answer = "Invalid price field requested";
Alert(answer);
}
return(answer);
}
string maDescription(int mode)
{
string answer;
switch(mode)
{
case MODE_SMA: answer = "SMA" ; break;
case MODE_EMA: answer = "EMA" ; break;
case MODE_SMMA: answer = "SMMA" ; break;
case MODE_LWMA: answer = "LWMA" ; break;
default: answer = "Invalid MA mode requested";
Alert(answer);
}
return(answer);
}
"Great minds discuss ideas, average minds discuss events
  • Post #2
  • Quote
  • Apr 2, 2012 5:49am Apr 2, 2012 5:49am
  •  futurespec
  • Joined May 2011 | Status: If you think I'm mad, I must be mad | 1,058 Posts
Try changing......

int start(if (TimeMonth(TimeCurrent()) >= 1 && validindicator == true)
{
Alert("The Indicator has expired");
validindicator=false;
}
if(validindicator == false)
{
return(0);
}) {



to ...........

int start()
{
If you think I'm mad, I must be mad
 
 
  • Post #3
  • Quote
  • Apr 2, 2012 1:03pm Apr 2, 2012 1:03pm
  •  adeforex
  • Joined Aug 2008 | Status: Trading Live as a Professional Do | 381 Posts
please what should i change it to, i just need help. Is not working. Can you just help me with the code and what line to insert it. Thanks
"Great minds discuss ideas, average minds discuss events
 
 
  • Post #4
  • Quote
  • Apr 3, 2012 5:56am Apr 3, 2012 5:56am
  •  adeforex
  • Joined Aug 2008 | Status: Trading Live as a Professional Do | 381 Posts
oh no. Nobody is helping me, not happy
"Great minds discuss ideas, average minds discuss events
 
 
  • Post #5
  • Quote
  • Last Post: Apr 3, 2012 8:39am Apr 3, 2012 8:39am
  •  Xaphod
  • Joined Mar 2010 | Status: Member | 1,380 Posts
Why not ask the author(s) of the indicator(s) you want to protect for help as it looks like a commercial endeavor.

Tips:

ALL CAPS is tedious to read and considered shouting on the Internets.

Post code in code tags for improved readability and to prevent the editor from removing characters from the code.
[CODE ]Your code[/CODE ]
 
 
  • Platform Tech
  • /
  • Need help modifying a code to include Automatic Expiration
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2022