[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 60

 
I seem to recall that you are the one who modifies the order by setting it with the same parameters as before!
 
Look at the code carefully. Insert if necessary NormalizeDouble(Price_SELL, Digits) NormalizeDouble I mean, or whatever.
 
Dimka-novitsek:
I seem to remember that you are the one who modifies the order by setting it with the same parameters as before!

Most likely. I need to review the code. Although I have a check in place to make sure no such modification is repeated and the normalisation double stands. Thank you! I'll double-check it.
 

Once again I would like to ask you forum users. Could you please tell me how to implement a function for the script that calculates the lot to open an order. There are two input parameters: maximum drawdown in pips and volume of available funds.

For example, we have 1000 quid on our account. We enter the available funds as $250 and maximum drawdown as 50 points. On the basis of these data we open an order with the maximum lot at which if the price moves not in our direction, it will be able to survive -50 points, and at -51 points it will close itself due to the stop loss.

 

good afternoon,

I'm having trouble with the strategy tester. I load quotes and still on a minute timeframe the testing only happens on a certain interval, and there may be gaps in the data inside... I would like to test the Expert Advisor on a minute timeframe for a period of at least one year, not one week (

 
tpg_k156:

Once again I would like to ask you forum users. Could you please advise how to implement a function for the script that calculates the lot to open an order. There are two input parameters: maximum drawdown in pips and volume of available funds.

For example, we have 1000 quid on our account. We enter the available funds as $250 and maximum drawdown as 50 points. On the basis of these data we open an order with the maximum lot at which if the price moves not in our direction, it will be able to survive -50 points, and at -51 points it will close itself due to the stop loss.

You need to create an Expert Advisor, not a script. The script can calculate the number of lots based on the percentage of available funds per trade and open a position with a stop that is at least equal to the minimum allowed. If you want to trace a stop on every tick, you need an Expert Advisor with a trailing stop.

 
Notter:
the stop line is set on opening and is not further modified. How do you calculate the lot with -50pp drawdown capability and a fund size of 250 quid out of 1000.
 

tpg_k156:
стоп линия устанавливается при открытии и далее не модифицируется. Как расчитать лот имея -50пп возможности просадки и размер средств в 250 баксов из 1000.

In general, I'm not a guru at all, maybe that's why I don't understand, but in your conditions the lot is determined by the amount of money for the position, i.e. 250 quid. Further, the possible drawdown of the deposit will be determined by a stoploop. The minimum level of stop in points is specified in instrument's properties. If you use it, you can determine the drawdown of the deposit. If you set a larger stop-loss, the possible drawdown increases. If even at minimal stop-loss the inadmissible drawdown on the deposit is obtained, we reduce the size of the position, not 250, but for example 200.
 

Hello, help me to remake positions to open at the close of the candle. EA is based on trend or resistance line trading

//+------------------------------------------------------------------+

//Opening a position|
//+------------------------------------------------------------------+
void OpenPositions() {
bool lbBuy=False, lbSell=False;
double ldStop=0, ldTake=0;

if ((Ask>gdPrevAsk && Ask>=gdUpPrice && ebBuyFromUp)
|| (Ask<gdPrevAsk && Ask<=gdDnPrice && ebBuyFromDn)) lbBuy=True;
if ((Bid>gdPrevBid && Bid>=gdUpPrice && !ebBuyFromUp)
|| (Bid<gdPrevBid && Bid<=gdDnPrice && !ebBuyFromDn)) lbSell=True;

if (lbBuy) {
if (ExistPositionByOP(OP_SELL)) CloseAllPositions();
if (!ExistPositionByOP(OP_BUY)) {
if (StopLoss!=0) ldStop=Ask-StopLoss*Point;
if (TakeProfit!=0) ldTake=Ask+TakeProfit*Point;
OpenPosition(OP_BUY, ldStop, ldTake);
}
}
if (lbSell) {
if (ExistPositionByOP(OP_BUY) CloseAllPositions();
if (!ExistPositionByOP(OP_SELL)) {
if (StopLoss!=0) ldStop=Bid+StopLoss*Point;
if (TakeProfit!=0) ldTake=Bid-TakeProfit*Point;
OpenPosition(OP_SELL, ldStop, ldTake);
}
}
}
 
Folks help me find moving averages where out of 10 trades 8 will be profitable
Reason: