stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

How to add Account Number Based Lock for Indicator?
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4781
Page 1 of 2
Author:  MicroSpiderfx [ Mon Jun 27, 2016 10:12 am ]
Post subject:  How to add Account Number Based Lock for Indicator?

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:
Author:  renexxxx [ Mon Jun 27, 2016 10:31 am ]
Post subject:  How to add Account Number Based Lock for Indicator?

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);
}
Author:  arts [ Mon Jun 27, 2016 11:34 am ]
Post subject:  How to add Account Number Based Lock for Indicator?

Or alternatively swap ExpertRemove() for ChartIndicatorDelete()..
Author:  MicroSpiderfx [ Mon Jun 27, 2016 12:33 pm ]
Post subject:  How to add Account Number Based Lock for Indicator?

Thank you ... all of my master :hi: . Now its working :clap:
Author:  taipan [ Sat Aug 27, 2016 2:30 pm ]
Post subject:  How to add Account Number Based Lock for Indicator?

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.
Author:  renexxxx [ Sun Aug 28, 2016 7:33 am ]
Post subject:  How to add Account Number Based Lock for Indicator?

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.
Author:  taipan [ Sun Aug 28, 2016 11:34 am ]
Post subject:  How to add Account Number Based Lock for Indicator?

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.
Author:  renexxxx [ Sun Aug 28, 2016 11:59 am ]
Post subject:  How to add Account Number Based Lock for Indicator?

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.
Author:  taipan [ Sun Aug 28, 2016 4:15 pm ]
Post subject:  How to add Account Number Based Lock for Indicator?

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.
Author:  tomele [ Sun Aug 28, 2016 7:22 pm ]
Post subject:  How to add Account Number Based Lock for Indicator?

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
All times are UTC Page 1 of 2