[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 1010

 

Добрый день.Очень нужен советник,который будет лишь закрывать сделки.Дело в том,что вход в рынок может быть и обдуманный и с ясной головой и четкими правилами...А вот с выходом у многих-засада.Тут весь набор психологии: и нервы и надежда,и страх с жадностью.Думаю,что при входе по тренду,выход должен обеспечивать стохастик пересекающий уровень 50%.При пересечении сверху вниз должен закрывать бай-ордера,а при пересечении снизу вверх соответственно селл-ордера.

By the way, this advisor can replace the stupid stop-loss .....I think it would not be too difficult to write, and I think it would be useful.

 
Lim1:

Hello!

I have a question - where do the results of testing go (profitability, total number of trades, etc.) and how can we make these numbers be assigned to the variables (in the code) at the end of testing?

How can I make these numbers go into the variables (in the code) after testing? Thanks!


You write about optimization... Select the optimisation option (pass) you want, click it twice with your mouse - that's it... parameters of this pass

They are in the Expert Advisor "properties". You select the testing period with these parameters and go ahead... - Click on "start".

 

Please give me the code for calculating the recovery factor.

 

Good afternoon,

I can't decide which demo to use, many in the tester do not properly execute the algorithm.

What is your advice?

What is a martin and locking?

 

что такое мартин и локирование?


Type in a search on the website. Martingale. Locking is the opening of an opposite position. This is just to give you time to think about it. One position overrides the other and the account is kind of frozen.
 

Could you please tell me if it's possible to display test results data in the form of Alerts in the journal?

For example, enter a variable that would get the value of total amount of trades (or the value of the total profitability...) at the end of testing.

How to do it?

Optimization is out of the question...

 
Lim1:

Hello!

I have a question - where do the results of testing go (profitability, total number of trades, etc.) and how can we make these numbers be assigned to the variables (in the code) at the end of testing?

A detailed description of this article may be found in myAlpari.

See Self-Assessment of Testing Results of an Expert Advisor

 

there are two lines

The strategy is as follows: crossing the lines up-buy, down-sell.

I decided to consider a possibility: after crossing the lines price goes down to the line with a long period, buy, place a buy/sell order.

I decided to do it with the help of flags up/down,

but it didn't work

if (SMA_1_0 > SMA_2_0 && SMA_1_1 < SMA_2_1) // Check for crossing upwards
{

ClosePositions(); // if there is an order - remove

A=1; //flag upwards
B=0; //flag down
}
if (A ==1 )

{
SL=Bid - StopLoss*Point; // Calculation of SL open.
TP=Bid + TakeProfit*Point; // Calculation of TP open.
Alert("Trying to open Buy. Waiting for reply...");
Price_H =SMA_2_0 + 10* Point;
OpenPosition(Symbol(), OP_BUYLIMIT, Price_H,Lts, SL, TP);

if (Ticket > 0) // it worked :)
{
Alert ("Open Buy order ",Ticket;)
A=0;
B=0;
return;
}
}
//--------------------------------------------------------------------
if (SMA_1_0 < SMA_2_0 && SMA_1_1 > SMA_2_1) // Crossing down check
{

ClosePositions();

A=0; //flag upwards
B=1; //flag downwards
}
if (B == 1) // flag down if price has fallen to the SMA line
{
SL=Ask + StopLoss*Point; // Calculation of SL open
TP=Ask - TakeProfit*Point; // Calculation of TP open.
Alert("Attempting to open Sell. Waiting for reply...");
Price_L =SMA_2_0 - 10* Point;
OpenPosition(Symbol(), OP_SELLLIMIT, Price_L,Lts, SL, TP);
if (Ticket > 0) // it worked :)
{
Alert ("Sell order opened ",Ticket;)
A=0;
B=0;
return; // Exit from start()
}
}
//---------
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialisation function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+

//+----------------------------------------------------------------------------+
//| Author : Kim Igor V. aka KimIV, http://www.kimiv.ru/ |
//+----------------------------------------------------------------------------+
//| Version : 19.02.2008 |
//| Description : Closing of positions at market price |
//+----------------------------------------------------------------------------+
//| Parameters: |
//| sSymbol - name of instrument ("" - any symbol, |
//| NULL - current symbol) |
//| iOperation - operation (-1 - any position) |
//| iMagic - MagicNumber (-1 - any magik) |
//+----------------------------------------------------------------------------+

void ClosePositions(string sSymbol = "", int iOperation = -1, int iMagic = -1) {
int i, k = OrdersTotal();

//if (sSymbol == "0") sSymbol = Symbol();
for (i = k - 1; i >= 0; i--) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if ((OrderSymbol() == sSymbol || sSymbol == "") && (iOperation < 0 || OrderType() == iOperation)) {
if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
if (iMagic < 0 || OrderMagicNumber() == iMagic) ClosePosBySelect();
}
}
}
}
}

//+----------------------------------------------------------------------------+
//+----------------------------------------------------------------------------+
//| Author : Kim Igor V. aka KimIV, http://www.kimiv.ru/ |
//+----------------------------------------------------------------------------+
//| Version : 13.06.2007 |
//| Description : Closing of one pre-selected position |
//+----------------------------------------------------------------------------+
void ClosePosBySelect() {
double pp;

if (OrderType()==OP_BUY) {
pp=MarketInfo(OrderSymbol(), MODE_BID);
OrderClose(OrderTicket(), OrderLots(), pp, Slippage);
}
if (OrderType()==OP_SELL) {
pp=MarketInfo(OrderSymbol(), MODE_ASK);
OrderClose(OrderTicket(), OrderLots(), pp, Slippage);
}
}

//+----------------------------------------------------------------------------+
//| Author : Kim Igor V. aka KimIV, http://www.kimiv.ru/ |
//+----------------------------------------------------------------------------+
//| Version : 13.06.2007 |
//| Description : Opening of a position. Version of the function for history tests. |
//+----------------------------------------------------------------------------+
//| Parameters: |
//| sy - name of the instrument ("" - current symbol) |
//| op - operation |
|| ll - lot
//| sl - stop level |
//| tp - take level |
//| mn - MagicNumber |
//+----------------------------------------------------------------------------+
void OpenPosition(string sy, int op, double ll, double sl=0, double tp=0, int mn=0) {
double pp;
int err, ticket;

if (sy=="") sy=Symbol();
if (op==OP_BUY) {
pp=MarketInfo(sy, MODE_ASK);
} else {
pp=MarketInfo(sy, MODE_BID);
}
ticket=OrderSend(sy, op, ll, pp, Slippage, sl, tp, "", mn, 0);
if (ticket<0) {
err=GetLastError();
Print("Error(",err,") open ",GetNameOP(op),": ",ErrorDescription(err));
Print("Ask=",Ask," Bid=",Bid," sy=",sy," ll=",ll,
" pp=",pp," sl=",sl," tp=",tp," mn=",mn);
}
}

//+----------------------------------------------------------------------------+
//| Author : Kim Igor V. aka KimIV, http://www.kimiv.ru/ |
//+----------------------------------------------------------------------------+
//| Version : 01.09.2005 |
//| Description : Returns the name of trade operation |
//+----------------------------------------------------------------------------+
//| Parameters : ||
//| iOperation - identifier of trade operation ||
//+----------------------------------------------------------------------------+

string GetNameOP(int iOperation) {
switch (iOperation) {
case OP_BUY: return ("Buy");
case OP_SELL: return ("Sell");
case OP_BUYLIMIT: return ("Buy Limit");
case OP_SELLLIMIT: return ("Sell Limit");
case OP_BUYSTOP: return ("Buy Stop");
case OP_SELLSTOP: return ("Sell Stop");
default: return ("Unknown Operation");
}
}

 

Gentlemen, fellow friends! Who knows, please share the link where you can see/feel the formulas for solving the equations of arithmetic progression of the second order.

For example:

In an arithmetic progression, the differences between consecutive terms are constant. If the differences are not constant, but the differences of the differences are constant, then the progression is called an arithmetic progression of the second order. Arithmetical progressions of higher orders are defined in a similar way. For example, 2, 6, 12, 20, 30, ..., n is a second-order arithmetic progression because the differences of 4, 6, 8, 10, ..., n form an arithmetic progression with d = 2.

Here I need formulas for calculations to find the number of members of such a progression... I searched all over Internet - only simple mathematics around... :((((

 
artmedia70:

Gentlemen, fellow friends! Who knows, please share the link where you can see/feel the formulas for solving second-order arithmetic progression equations.

Googled
Reason: