[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 122
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello ! Could you please help me complete the Trailing Stop and Trailing Step for a year and I can't find it in my head !
where to add trailing stop and breakeven output ? and it does not increase the lot when you increase the deposit
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int Buy (int StopLoss = 0, int TakeProfit = 0, double Lot = 0)
{
int Ticket = 0;
double SL = 0;
double TP = 0;
double VolumeLot = 0;
RefreshRates();
if (StopLoss != 0)
SL = NormalizeDouble(Bid-StopLoss*Point, Digits);
if (TakeProfit != 0)
TP = NormalizeDouble(Ask+TakeProfit*Point, Digits);
if (Lot == 0)
VolumeLot = GetLot ();
else
VolumeLot = Lot;
Ticket = OrderSend(Symbol(), OP_BUY, VolumeLot, NormalizeDouble(Ask, Digits), 20, SL, TP, NULL, AccountNumber(), 0, Green);
if (Ticket == -1)
{
return (GetLastError ();
}
else
{
return (Ticket);
}
}
int Sell (int StopLoss = 0, int TakeProfit = 0, double Lot = 0)
{
int Ticket = 0;
double SL = 0;
double TP = 0;
double VolumeLot = 0;
RefreshRates();
if (StopLoss != 0)
SL = NormalizeDouble(Ask+StopLoss*Point, Digits);
if (TakeProfit != 0)
TP = NormalizeDouble(Bid-TakeProfit*Point, Digits);
if (Lot == 0)
VolumeLot = GetLot ();
else
VolumeLot = Lot;
Ticket = OrderSend(Symbol(), OP_SELL, VolumeLot, NormalizeDouble(Bid, Digits), 20, SL, TP, NULL, AccountNumber(), 0, Red);
if (Ticket == -1)
return (GetLastError ();
else
return (Ticket);
}
double GetLot ()
{
int lot;
if (AccountBalance()>=300) lot=0.01;
if (AccountBalance()>=500) lot=0.02;
if (AccountBalance()>=800) lot=0.03;
return (lot);
}
where to add trailing stop and breakeven output ? and it does not increase the lot when you increase the deposit
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
In the advisor
function lot increase...... is probably better to change
example:
Look at Moving Average.mq4
Can you please tell me how to use bollinger bands for momentum, not for price? I tried it like this:
BandOPeriodT - external variable, period of bollinger bands.
MomentumPeriodT - period of momentum, respectively.
BandOBottom=iBands (NULL,0,BandOPeriodT,1,0,iMomentum(NULL,0,MomentumPeriodT,PRICE_OPEN,0),MODE_LOWER,0);
and also like this:
MomO=iMomentum(NULL,0,MomentumPeriodT,PRICE_OPEN,0); - internal variable which returns the value
BandOBottom=iBands(NULL,0,BandOPeriodT,1,0,MomO,MODE_LOWER,0); - the variable should return the value of the lower Bollinger line for the previous variable value.
Also, am I right in assuming that MODE_LOWER means I get the value of BOLLINGER BOLLINGER in a variable? If not, how do I get it exactly?
Can you please tell me how to use bollinger bands for momentum, not for price? I tried it like this:
BandOPeriodT - external variable, period of bollinger bands.
MomentumPeriodT - period of momentum, respectively.
BandOBottom=iBands (NULL,0,BandOPeriodT,1,0,iMomentum(NULL,0,MomentumPeriodT,PRICE_OPEN,0),MODE_LOWER,0);
and also like this:
MomO=iMomentum(NULL,0,MomentumPeriodT,PRICE_OPEN,0); - internal variable which returns the value
BandOBottom=iBands(NULL,0,BandOPeriodT,1,0, MomO,MODE_LOWER,0); - the variable should return the value of the lower Bollinger line for the previous variable value.
Also, am I right in assuming that MODE_LOWER means I get the value of BOLLINGER BOLLINGER in a variable? If not, how do I get it exactly?
See trailer - there Bands for RSI - do the same for Momentum.
Description - in the log - see code at the beginning.
Hello! Please help! I want to try the PVT indicator:
Can you please tell me what is missing?
It says: 2012.05.14 19:34:46 Cannot open file 'C:\Program Files\Alpari NZ MT4\experts\indicators\PVT.ex4' on the EURUSD,H4
Thank you!
where to add trailing stop and breakeven output ? and it does not increase the lot when you increase the deposit
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int Buy (int StopLoss = 0, int TakeProfit = 0, double Lot = 0)
{
int Ticket = 0;
double SL = 0;
double TP = 0;
double VolumeLot = 0;
RefreshRates();
if (StopLoss != 0)
SL = NormalizeDouble(Bid-StopLoss*Point, Digits);
if (TakeProfit != 0)
TP = NormalizeDouble(Ask+TakeProfit*Point, Digits);
if (Lot == 0)
VolumeLot = GetLot ();
else
VolumeLot = Lot;
Ticket = OrderSend(Symbol(), OP_BUY, VolumeLot, NormalizeDouble(Ask, Digits), 20, SL, TP, NULL, AccountNumber(), 0, Green);
if (Ticket == -1)
{
return (GetLastError ();
}
else
{
return (Ticket);
}
}
int Sell (int StopLoss = 0, int TakeProfit = 0, double Lot = 0)
{
int Ticket = 0;
double SL = 0;
double TP = 0;
double VolumeLot = 0;
RefreshRates();
if (StopLoss != 0)
SL = NormalizeDouble(Ask+StopLoss*Point, Digits);
if (TakeProfit != 0)
TP = NormalizeDouble(Bid-TakeProfit*Point, Digits);
if (Lot == 0)
VolumeLot = GetLot ();
else
VolumeLot = Lot;
Ticket = OrderSend(Symbol(), OP_SELL, VolumeLot, NormalizeDouble(Bid, Digits), 20, SL, TP, NULL, AccountNumber(), 0, Red);
if (Ticket == -1)
return (GetLastError ();
else
return (Ticket);
}
double GetLot ()
{
int lot;
if (AccountBalance()>=300) lot=0.01;
if (AccountBalance()>=500) lot=0.02;
if (AccountBalance()>=800) lot=0.03;
return (lot);
}
for the symbol to which the Expert Advisor is attached. Also assume that the value of trailing stop
in pips is contained in the TrailingStop variable.
The OrderProfit() function returns the profit for the order selected using the OrderSelect() function.
Suppose that we want to calculate the profit that we have gained from closed positions.
And the full code that calculates the profit for all closed positions,
that are opened today, will be:
? And it doesn't increase the lot size when you increase the deposit
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Maybe there is something else missing in the code:
The order must be pre-selected using OrderSelect().
Hello! Please help! I want to try the PVT indicator:
Can you please tell me what is missing?
It says: 2012.05.14 19:34:46 Cannot open file 'C:\Program Files\Alpari NZ MT4\experts\indicators\PVT.ex4' on the EURUSD,H4
Thank you!