Register a Product as Hidden or Private - page 2

 
Soewono Effendi #:

During uploading to Market, you might have chosen wrong category.

Wrong category ? well what kind of category should be ? 

I choose indicators as product and multi currency as type , so how can register a product like this one , a candle timer that counts till bar close , what category should I use , utilities and utility type informers ?

 

Forum on trading, automated trading systems and testing trading strategies

Register a Product as Hidden or Private

Fernando Carreiro, 2023.04.12 01:11

We can't read your mind nor see your code, but probably it has some bugs—maybe there is a mix of old and new MQL4 event handlers or maybe a mix of event handlers that should not be in the indicator.

Without analysing the code, we can't help much.

What event handlers are used in your code ?
 
Alain Verleyen #:
What event handlers are used in your code ?

Hi, could you please tell me why this piece of code doesn't work on MAC OS ( I've tried on intel based macs and m1 based macs) , on windows works , but not on mac os.

The code should give the price in the area you clicked using  SHIFT key + Click , this is the code :


int init()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }


void deinit()
  {
//---
   
  }

void OnTick()
  {
//---
   
  }
bool IsKeyShift (void) {return(::TerminalInfoInteger(TERMINAL_KEYSTATE_SHIFT) < 0);}

double entry_price;
double sl_price;

void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam)
{
   if(IsTradingAllowed())
   {
      
      // Press SHIFT + Click to set Entry Price
      if( IsKeyShift() && id == CHARTEVENT_CLICK)
      {
         datetime time;
         double price;
         int subwindow;
         ChartXYToTimePrice(0, int(lparam), int(dparam), subwindow, time, price);
         price = NormalizeDouble(price, _Digits);
         entry_price = price;
         Print("SHIFT + Click Entry price: " + entry_price);
      }
}
}

the function IsTradingAllowed() is a custom function checking is the button Auto Trading is on or off and if the markets are open or not , you can ignore it or comment it out.


I've tried using other keys , but still not doing anything when using a key + click in order to give the price based on the place you clicked...

 
Alexandru Stefanel Niculae #: Hi, could you please tell me why this piece of code doesn't work on MAC OS ( I've tried on intel based macs and m1 based macs) , on windows works , but not on mac os.

The code should give the price in the area you clicked using  SHIFT key + Click , this is the code :

int init() {}
void deinit() {}
void OnTick() {}

The above code is why your product is not being properly processed.

"init" and "deinit" is old MQL4 and "OnTick()" is modern MQL4+ but it is for EAs and not indicators.

Don't mix old and new event handlers and use only the proper handlers for the type of program being submitted.

I suggest you only use the modern and more strict MQL4+ coding for your products ... Updated MQL4 - Language Basics - MQL4 Reference

 
Fernando Carreiro #:

The above code is why your product is not being properly processed.

"init" and "deinit" is old MQL4 and "OnTick()" is modern MQL4+ but it is for EAs and not indicators.

Don't mix old and new event handlers and use only the proper handlers for the type of program being submitted.

I suggest you only use the modern and more strict MQL4+ coding for your products ... Updated MQL4 - Language Basics - MQL4 Reference

I wasn't talking about the indicator in the comment above. The comment above was a different question.

In the comment above I've send a piece of code from a EA / Utility type that is not working on mac os , but works on windows.

 
Alexandru Stefanel Niculae #: I wasn't talking about the indicator in the comment above. The comment above was a different question. In the comment above I've send a piece of code from a EA / Utility type that is not working on mac os , but works on windows.

It may be a different question, but it is clear from this example, that you are mixing event handler types. So it stands to reason that the same cause applies to your initial issue of the indicator product being misclassified.

As for the Mac/Windows issue, I have little experience on the Mac, However I do believe that key states are different between the two operating systems.

 

I've changed to the new version of functions OnInit , OnDeinit OnTick , the problem wasn't there , the problem is that , if I check only for the SHIFT KEY was pressed is showing on mac os too the alert , then if I check only for the CLICK event also is printing the alert, the problem arrive when the two are used to inside that IF condition , when they are combined together is not working anymore.


So I've tried to create a new version for MAC only that uses MAC key codes ( is that what you meant by different key states between MAC and WINDOWS  ? ) like the key code for SHIFT key on mac is 57 while on windows is 16 , but when I check for the SHIFT key as you noticed above I use this code :

bool IsKeyShift (void) {return(::TerminalInfoInteger(TERMINAL_KEYSTATE_SHIFT) < 0);}


So basically if I use this code to only check if the SHIFT key was press using the CHARTEVENT_KEYDOWN , is working I mean it returns 0 .. 

So what else could be , any ideas ?

 
Alexandru Stefanel Niculae #:

I've changed to the new version of functions OnInit , OnDeinit OnTick , the problem wasn't there , the problem is that , if I check only for the SHIFT KEY was pressed is showing on mac os too the alert , then if I check only for the CLICK event also is printing the alert, the problem arrive when the two are used to inside that IF condition , when they are combined together is not working anymore.


So I've tried to create a new version for MAC only that uses MAC key codes ( is that what you meant by different key states between MAC and WINDOWS  ? ) like the key code for SHIFT key on mac is 57 while on windows is 16 , but when I check for the SHIFT key as you noticed above I use this code :


So basically if I use this code to only check if the SHIFT key was press using the CHARTEVENT_KEYDOWN , is working I mean it returns 0 .. 

So what else could be , any ideas ?

Your topic title is "Register a Product as Hidden or Private". As this been solved or not ?

You are very unlikely to get answers to off-topic questions about Mac or keys events.

 
Alain Verleyen #:

Your topic title is "Register a Product as Hidden or Private". As this been solved or not ?

You are very unlikely to get answers to off-topic questions about Mac or keys events.

It has been solved , but for now my main focus is not on the " Register a product as Hidden or Private".


I understand that this is not the place where I can get the answer for my mac and keys events , but when I ask abou this problem no body answers , and I get all kind of off topic answers ...


Anyways thanks!