pip calculator unexpected ending e.d
pip calculator unexpected ending e.d
Loading saved threads...
Jiano Van Goethem · External communityPost link
External question — Stack Overflow Stack Exchange
Author: Jiano Van Goethem
Original post: https://stackoverflow.com/questions/65593640
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I've been working on an Expert advisor course for Metatrader 4 and I keep getting errors with my code and I don't see the mistake.
I seem to have closed everything, and I don't see the mistake, anyone who can help?
the goal of the code is to know what a pip is, and to calculate the Take profit and the stoploss depending on the entryprice and a stuck pip value
//+------------------------------------------------------------------+
//| CalculateStoplossAndTakeProfit.mqh |
//| Jiano van Goethem |
//| |
//+------------------------------------------------------------------+
#property copyright "Jiano van Goethem"
#property link ""
#property strict
#include <Pipcalculator.mqh>
void OnStart()
{
//---
Alert("");
double SignalPrice = 1.368;
int TakeProfitPips = 50;
int StoplossPips = 50;
double GetPipValue = GetPip
if(Ask < SignalPrice) // buying
{
Alert("sending buy order ");
double StopLossPrice = Ask - StoplossPips * GetPipValue();
double TakeProfitPrice = Ask + TakeProfitPips * GetPipValue();
Alert("entry price = " + Ask);
Alert ("Stop loss price = " + StopLossPrice);
Alert ("Take profit price = " + TakeProfitPrice);
//send buyorder
}
else if(Bid > SignalPrice) // selling
{
Alert("sending sell order ");
double StopLossPrice = Bid + StoplossPips * GetPipValue();
double TakeProfitPrice = Bid - TakeProfitPips * GetPipValue();
Alert("entry price = " + Bid);
Alert ("Stop loss price = " + StopLossPrice);
Alert ("Take profit price = " + int(TakeProfitPrice));
//send sellorder
}
}
Unexpected end of program line 51
//Function to calculate the decimal digits
//Digits is a native variable in MetaTrader which is assigned as a value the number of digits after the point
double PipValue = GetPipValueFromDigits()
double GetPipValueFromDigits()
{ //If there are 3 or less digits (JPY for example) then return 0.01 which is the pip value
if(Digits<=3){
return(0.01);
}
//If there are 4 or more digits then return 0.0001 which is the pip value
else if(Digits>=4){
return(0.0001);
}
//In all other cases (there shouldn't be any) return 0
else return(0);{
}
}
unbalanced parenthesis line 11
Quote
Report
Post Reply
Checking account access…