[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 420

 

declare a variable

bool ret;

before the loop

 

snowman647, huh?)

there's nothing wrong with the compilation, something's wrong with the algorithm.

 
Summer писал(а) >>

snowman647, huh?)

There's nothing wrong with the compilation, something's wrong with the algorithm.

Probably need to watch how new positions are opened.

 
Folks, who can give me a hint. Yesterday I was doing an EA on Murray levels. The idea is to sell/buy from 8/0 and 0/8 levels and TP to pivot. I used ObjectGet() to get the lines as I couldn't find any other way. The problem is that if volatility decreases, the levels are re-drawn and the most important thing is that TP automatically changes. But according to TS it should not change. But how should we keep TP unchanged? I am thankful for the help in advance.
 
Vinin >>:

Наверно надо смотреть как открываются новые позиции

it does open, but it doesn't want to close)

There must be something wrong with the closing algorithm.

The code is the simplest, can't any of the experienced progamers understand what's wrong?)

 
Good day to all! I am testing an EA in real time on a demo account (the terminal is running 24 hours a day). I have a question! Metatrader is able to issue statistics on really working EA on the basis of those operations, which he did (of course I do not mean back test here)? THANK YOU ALL!
 
Summer писал(а) >>

it does open, but it doesn't want to close)

There must be something wrong with the closing algorithm.

The code is simple, can't any of the experienced progamers understand what's wrong?)

If opening does not use Magik, then how can you close by Magik. That's why the question arises.

 

Vinin, my good man) the magician is worth it))

extern double Lots=0.1;

int start()
{

bool ret;

double Ind11=iMA(NULL,0,12,0,0,0,0);
double Ind12=iMA(NULL,0,12,0,0,0,1);

if(Ind11>Ind12)
{

OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"",16384,0,Green);

}

if(Ind11<Ind12)
{



for(ic=OrdersTotal()-1;ic>=0;ic--)
{
if(OrderSelect(ic,SELECT_BY_POS,MODE_TRADES)==false) continue;
if (OrderSymbol()==Symbol() && OrderMagicNumber()==16384)
{
if (OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),Bid,5,CLR_NONE);

if (OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),Ask,5,CLR_NONE);
}}



}

return(0);

}

 
Necron >>:
Народ, кто может подсказать. Вчера делал советника по уровням Мюррея. Там смысл такой, что от уровней 8/0 и 0/8 надо продавать/покупать, а TP на пивот. Я использовал ObjectGet() чтобы получить линии, т.к. другого способа не нашел. Проблема в том, что если снижается волатильность, то уровни перерисовываются, и что самое главное автоматически меняется и TP. А менятся по ТС не должен. А вот как сделать чтоб TP не менялся? Заранее благодарен за помощь.

fix the algorithm for calculating lines and pivot

 
Summer >>:

Vinin, уважаемый) магик то стоит))

extern double Lots=0.1;

int start()
{

bool ret;

double Ind11=iMA(NULL,0,12,0,0,0,0);
double Ind12=iMA(NULL,0,12,0,0,0,1);

if(Ind11>Ind12)
{

OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"",16384,0,Green);

}

if(Ind11<Ind12)
{



for(ic=OrdersTotal()-1;ic>=0;ic--)
{
if(OrderSelect(ic,SELECT_BY_POS,MODE_TRADES)==false) continue;
if (OrderSymbol()==Symbol() && OrderMagicNumber()==16384)
{
if (OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),Bid,5,CLR_NONE);

if (OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),Ask,5,CLR_NONE);
}}



}

return(0);

}

Give NormalizeDouble(Ask, Digits) instead of Ask, NormalizeDouble(Bid, Digits) instead of Bid, and it will work

Reason: