Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 50

 
wwowwa:

Please advise if anyone knows. Gepard 5.0 Expert Advisor on Forex4you is opening some trades with big minus. Where can I adjust the settings?



If you want to fine-tune your settings, you can do a history check, just check the settings, choose a start time step and end time step. For example, if you want to set take profit, then choose 1, then step 1 and stop 100, then check optimize and the EA will run through all the options, changing the take profit to 1 and then show the drawdown and profits

If you mean different, you need to specify what you mean by adjusting the settings

 
I don't know how to explain it. When the EA opens a new order in the "Profit" column, it immediately shows a big minus, as if it triggers with a big delay and goes into minus. Maybe I should change the settings in the EA itself but I am afraid of making a mess. Most of the time trading is going slowly with profit.
 
maybe my trader takes 2 pips per trade... i.e. i open positives i get minus 2... maybe my Expert Advisor is lousy... find out how much a trader takes per trade
 
No, mostly trades are opened with a small minus, but today on gold I opened with -9.58. And then he spent the whole day in the black. What does he want.
 
Merincool:


how? if the indicator is windowed, how do you display the arrows on the chart? only use 4 buffers


For chart, sorry, I probably did not read it carefully. Although you can use the second indicator that uses calculations from the first one

 
Let me try again, advise how to do it right, so that after opening exactly this position, the code of the Expert Advisor starts working from the beginning, when I do

if (ticketbuy>0)
{
return;
}

it doesn't open any more orders by other conditions which go below in the code, i.e. it sees this one>0, but I may have several of them open. Thanks.
 

Hello, gentlemen! Problem,

how do I place an order if its TP should be 100?

The error 130 is shown on the EUR/USD pair.

Maybe I should use Kim's CorrectingPrice function, but what is the opening/setting price? Ask/Bid

How do I use this function?

//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 02.07.2013                                                     |
//|  Описание : Выполняет корректирование ценовых уровней под STOPLEVEL.       |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование торгового инструмента                                 |
//|    op - торговая операция                                                  |
//|    pp - цена открытия/установки                                            |
//|    sl - ценовой уровень StopLoss                                           |
//|    tp - ценовой уровень TakeProfit                                         |
//+----------------------------------------------------------------------------+
void CorrectingPrice(string sy, int op, double& pp, double& sl, double& tp) {
  if (sy=="" || sy=="0") sy=Symbol();
  RefreshRates();
  int    di=MarketInfo(sy, MODE_DIGITS);
  int   msl=MarketInfo(sy, MODE_STOPLEVEL);
  int    sp=MarketInfo(sy, MODE_SPREAD);
  double mp=MarketInfo(sy, MODE_POINT);
  double pa=MarketInfo(sy, MODE_ASK);
  double pb=MarketInfo(sy, MODE_BID);
  double ds=NormalizeDouble(pp-sl, di);
  double dp=NormalizeDouble(pp-tp, di);

  if (msl==0) msl=2*sp;
  switch (op) {
    case OP_BUY:
      pp=pa;
      sl=pp-ds;
      tp=NormalizeDouble(pp-dp, di);
      if (sl>pp-msl*mp) sl=pp-msl*mp;
      if (tp>0 && tp<pp+msl*mp) tp=pp+msl*mp;
      break;
    case OP_SELL:
      pp=pb;
      sl=NormalizeDouble(pp-ds, di);
      tp=pp-dp;
      if (sl>0 && sl<pp+msl*mp) sl=pp+msl*mp;
      if (tp>pp-msl*mp) tp=pp-msl*mp;
      break;
    case OP_BUYLIMIT:
      if (pp>pa-msl*mp) {
        pp=pa-msl*mp;
        sl=pp-ds;
        tp=NormalizeDouble(pp-dp, di);
      }
      if (sl>pp-msl*mp) sl=pp-msl*mp;
      if (tp>0 && tp<pp+msl*mp) tp=pp+msl*mp;
      break;
    case OP_BUYSTOP:
      if (pp<pa+msl*mp) {
        pp=pa+msl*mp;
        if (sl>0) sl=pp-ds;
        if (tp>0) tp=NormalizeDouble(pp-dp, di);
      }
      if (sl>pp-msl*mp) sl=pp-msl*mp;
      if (tp>0 && tp<pp+msl*mp) tp=pp+msl*mp;
      break;
    case OP_SELLLIMIT:
      if (pp<pb+msl*mp) {
        pp=pb+msl*mp;
        sl=NormalizeDouble(pp-ds, di);
        tp=pp-dp;
      }
      if (sl>0 && sl<pp+msl*mp) sl=pp+msl*mp;
      if (tp>pp-msl*mp) tp=pp-msl*mp;
      break;
    case OP_SELLSTOP:
      if (pp>pb-msl*mp) {
        pp=pb-msl*mp;
        sl=NormalizeDouble(pp-ds, di);
        tp=pp-dp;
      }
      if (sl>0 && sl<pp+msl*mp) sl=pp+msl*mp;
      if (tp>pp-msl*mp) tp=pp-msl*mp;
      break;
    default:
      Message("CorrectingPrice(): Неизвестная торговая операция!");
      break;
  }
}
   
 
wwowwa:
Today I opened my trade with gold at -9.58. And then he spent the whole day in the black. What does he want.

Look at the price of one pip for gold and the spread, and hopefully everything will become clear.

Tip: A Buy position opens at the Ask price, while the Bid is smaller than the Ask by the size of the spread. As soon as you open a position, it is immediately opened with a minus equal to the spread. So, it's not the Expert Advisor that needs something, it's you who needs to learn the basics.

 
Top2n:

Hello, gentlemen! Problem,

how do I place an order if its TP should be 100?

The error 130 is shown on the EUR/USD pair.

Maybe I should use Kim's CorrectingPrice function, but what is the opening/setting price? Ask/Bid

How do I use this function?

The take should be 100 pips from the opening price, not 100. That is why you have an error.

You take the opening price, add (for Buy) or subtract (for Sell) 100 pips to it (or from it) multiplied by the Point and you get the Take price. Before you send your trade order to the server, make sure your Take is within the Stop-Level limit of your brokerage company. The answer to your follow-up question is here.

 
artmedia70:

Take should be equal to 100 pips from the opening price, not 100. That is why you have an error.

You take the open price and add (for Buy) or subtract (for Sell) 100 points to it (from it) multiplied by the point and you obtain the Take price. Before you send your trade order to the server, make sure your Take is within the Stop-Level limit of your brokerage company. The answer to your follow-up question is here.



Thank you, but I understand that you have to calculate the TP (Ask + TP * Point) for BUY etc.

It turns out that TP=100 pips is not set at once, and, for example, at 130 pips it works. But if we do it in a manual mode, we can set an order at first and then tighten TP by 100 pips.

The broker has a StopLeverage at 0.00050.

Maybe, when opening TP it calculates without any spread but at a declared price. Although, this is absurd.

Reason: