How to add Account Number Based Lock for Indicator?

User avatar
MicroSpiderfx
Trader
Posts: 15
Joined: Fri Feb 27, 2015 12:46 pm

How to add Account Number Based Lock for Indicator?

Post by MicroSpiderfx »

Hi, I wanted to add account number limitation in my Indicator . I am doing

Code: Select all

if(AccountNumber()!=11212){
ExpertRemove()};
But Problem is that .. i dont know why its not working for indicator .. its working good in EA . :youknow:
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

How to add Account Number Based Lock for Indicator?

Post by renexxxx »

MicroSpiderfx » Mon Jun 27, 2016 8:12 pm wrote:Hi, I wanted to add account number limitation in my Indicator . I am doing

Code: Select all

if(AccountNumber()!=11212){
ExpertRemove()};
But Problem is that .. i dont know why its not working for indicator .. its working good in EA .
You can do something like this in OnInit() of indicator:

Code: Select all

int OnInit() {
   if ( AccountNumber() != 11212 ) {
      Alert("Wrong account number ... ");
      return( INIT_FAILED );
   }
   
//---
   return(INIT_SUCCEEDED);
}
arts
Trader
Posts: 10
Joined: Thu Nov 17, 2011 2:09 pm

How to add Account Number Based Lock for Indicator?

Post by arts »

Or alternatively swap ExpertRemove() for ChartIndicatorDelete()..
User avatar
MicroSpiderfx
Trader
Posts: 15
Joined: Fri Feb 27, 2015 12:46 pm

How to add Account Number Based Lock for Indicator?

Post by MicroSpiderfx »

Thank you ... all of my master :hi: . Now its working :clap:
taipan
Trader
Posts: 355
Joined: Sat Feb 16, 2013 11:27 am

How to add Account Number Based Lock for Indicator?

Post by taipan »

renexxxx » Mon Jun 27, 2016 6:31 pm wrote:
You can do something like this in OnInit() of indicator:

Code: Select all

int OnInit() {
   if ( AccountNumber() != 11212 ) {
      Alert("Wrong account number ... ");
      return( INIT_FAILED );
   }
   
//---
   return(INIT_SUCCEEDED);
}
Renexxxx,

The coding seemed not to work with the latest Empty4 build 1010. Any update to make it work?

I have compile errors.
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

How to add Account Number Based Lock for Indicator?

Post by renexxxx »

taipan » Sun Aug 28, 2016 12:30 am wrote: The coding seemed not to work with the latest Empty4 build 1010. Any update to make it work?
Oh dear. There is not much code there, so I'm not sure what it is that could possibly be wrong. You didn't mention the compile error ...

I have tested the attached code under 1010. Mind you, I didn't feel like "upgrading" to 1010...

Anyway, it compiles and it works.

Over to you.
You do not have the required permissions to view the files attached to this post.
taipan
Trader
Posts: 355
Joined: Sat Feb 16, 2013 11:27 am

How to add Account Number Based Lock for Indicator?

Post by taipan »

renexxxx » Sun Aug 28, 2016 3:33 pm wrote: Oh dear. There is not much code there, so I'm not sure what it is that could possibly be wrong. You didn't mention the compile error ...

I have tested the attached code under 1010. Mind you, I didn't feel like "upgrading" to 1010...

Anyway, it compiles and it works.

Over to you.
Hi Renexxxx,

The first image is where i inserted your code on the int init() routine of the indicator.

2nd image is the compiled error.

See attached of my insertion of your code with compiled errors.

Need further help on where to insert the code correctly.

Thanks.
You do not have the required permissions to view the files attached to this post.
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

How to add Account Number Based Lock for Indicator?

Post by renexxxx »

taipan » Sun Aug 28, 2016 9:34 pm wrote:
Need further help on where to insert the code correctly.
Send me the code and I will insert it for you. These screenshots don't help me much. I seems that you have inserted the code just willy nilly in the middle of the file.

R.
taipan
Trader
Posts: 355
Joined: Sat Feb 16, 2013 11:27 am

How to add Account Number Based Lock for Indicator?

Post by taipan »

renexxxx » Sun Aug 28, 2016 7:59 pm wrote:
taipan » Sun Aug 28, 2016 9:34 pm wrote:
Need further help on where to insert the code correctly.
Send me the code and I will insert it for you. These screenshots don't help me much. I seems that you have inserted the code just willy nilly in the middle of the file.

R.
Renexxxx,

I had sent you indicator via pm.

Thanks.
User avatar
tomele
Administrator
Posts: 1208
Joined: Tue May 17, 2016 3:40 pm
Location: Germany, Forest of Odes, Defending the Limes

How to add Account Number Based Lock for Indicator?

Post by tomele »

renexxxx » 28 Aug 2016, 13:59 wrote:
I seems that you have inserted the code just willy nilly in the middle of the file.

R.
... and screwed the first line completely
Happy pippin, Thomas :-BD

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so.
(Mark Twain)

Keep the coder going: Donate
Post Reply

Return to “Coders Hangout”