Home>
https://minagachi.com/price-to-pips
I tried to set the price to pips with reference to this site, but I copied and copied the code as it was, but I got an error.
I want to eliminate the error.
'PriceToPips'-function declarations are allowed on global, namespace or class scope only pips.mq4 40 8
Applicable source code
//+----------------------------------------------- -------------------+
//| Function to convert price to pips
//+----------------------------------------------- -------------------+
double PriceToPips(double price)
{
double pips = 0;
// Get the number of decimal places of the current currency pair
int digits = (int)MarketInfo(Symbol(), MODE_DIGITS);
// In case of 3 digit/5 digit FX broker
if(digits == 3 || digits == 5){
pips = price * MathPow(10, digits)/10;
}
// For 2-digit and 4-digit FX brokers
if(digits == 2 || digits == 4){
pips = price * MathPow(10, digits);
}
// Round the decimal point to one digit (change the number of digits depending on the purpose)
pips = NormalizeDouble(pips, 1);
return(pips);
}
What I tried
I looked up the error code, but I do not understand it well, I tried translating it
"Function declarations are only allowed in global, namespace, or class scope."
It came out.
However, I'm just starting the program and I don't understand what it means.
Please provide more detailed information here.
-
Answer # 1
Related articles
- [ruby] i don't understand the meaning of the error statement
- i don't understand the meaning of a c++ error
- java - compile error i can't understand the meaning of illigal start of expression
- [python] i don't understand the meaning of the error
- latex pdf compilation error using vscode
- javascript - this is js i don't really understand the meaning of the syntax below i would appreciate it if anyone could teach me
- vba - i don't understand the cause of the error code "object variable or with block variable not set"
- c++ - i want to know the meaning of the error "undefined base class is declared" * large scale
- compile error - about mql4 compilation error
- i do not understand the meaning of as in foreach that appears in php
- arduino - i do not understand the meaning of commandreceiver and commandtransmitter of esp32
- html - i don't understand the meaning of the return
- c++ - i want to understand the meaning of the part i do not understand because the description of the code that fixes the frame
- c++ - compilation error with a string
- about ds3231 compilation error on arduino
- make - compilation error with sheepshaver on raspberry pi 4
- ruby - asset file compilation error in aws production environment
- ruby on rails 5 - i do not understand the meaning of self in the model
- c++ - compilation error due to random number generation method
Related questions
- mql4 how to display multiple objects on the indicator
- c ++ - dll using libcurl cannot be executed correctly in mql4 program
- unable to get indicator value using icustom function in mql4
- c# - i want to be able to settle when the closing price enters the cloud of the ichimoku kinko hyo
- c# - how to resolve possible loss of data due to type conversion
- mql4 - ea to enter by twisting clouds in the ichimoku kinko hyo
- c ++ - i can't build a dll using libcurl with visual stadio
- can't get proper value with arraybsearch in mql4
- mql4 - i want to display a popup window with a message along with the alert sound of the mt4 sign indicator
- mql4 - i want to put a character string in the global variable in metatrade
It seems that it was because I put it in OnTick.