Initial deposit size - what is it? - page 9

 

Down with the glitchy wind :)


To measure an angle, you need a point + datum and a point at which to measure the angle.


For starters:

int cnt, total;
total=OrdersTotal();
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
iTicket=OrderTicket();
}

 
meta-trader2007 писал (а) >>

For starters:

Here's a snippet of code with an order overrun. The trailing stop code is taken from here: 'Library of Functions and Expert Advisors for Trailing Stop / Yuri Dzyuban'.

   int cnt, itotal;
   total=OrdersTotal();
   for(cnt=0;cnt<total;cnt++)
   {
   OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
   iTicket=OrderTicket();
   Comment("\nOrderTicket = ", iTicket);

   // проверяем переданные значения
   if ((iTicket==0) || (!OrderSelect(iTicket,SELECT_BY_TICKET)) || ((iTmFrme!=1) && (iTmFrme!=5) && (iTmFrme!=15) && (iTmFrme!=30) && (iTmFrme!=60) && (iTmFrme!=240) && (iTmFrme!=1440) && (iTmFrme!=10080) && (iTmFrme!=43200)) || (iMAPeriod<2) || (MAMethod<0) || (MAMethod>3) || (iApplPrice<0) || (iApplPrice>6) || (iShift<0) || (iIndent<0))
      {
      Comment("\nТрейлинг функцией TrailingByMA() невозможен из-за некорректности значений переданных ей аргументов.");
      return(0);
      } 

   double   dMA; // значение скользящего среднего с переданными параметрами
   
   // определим значение МА с переданными функции параметрами
   dMA = iMA(Symbol(),iTmFrme,iMAPeriod,iMAShift,MAMethod,iApplPrice,iShift);
         
   // если длинная позиция, и её стоплосс хуже значения среднего с отступом в iIndent пунктов, модифицируем его
   if (OrderType()==OP_BUY)
      {
      if ((OrderStopLoss()<dMA-iIndent*Point) && (dMA-iIndent*Point<Bid-MarketInfo(Symbol(),MODE_STOPLEVEL)*Point))
         {
         if (!OrderModify(iTicket,OrderOpenPrice(),dMA-iIndent*Point,OrderTakeProfit(),OrderExpiration()))
         Comment("Не удалось модифицировать стоплосс ордера №",OrderTicket(),". Ошибка: ",GetLastError());
         }
      }
  
   // если позиция - короткая, и её стоплосс хуже (выше верхней границы канала или не определён, ==0), модифицируем его
   if (OrderType()==OP_SELL)
      {
      if (((OrderStopLoss()==0) || (OrderStopLoss()>dMA+(MarketInfo(Symbol(),MODE_SPREAD)+iIndent)*Point)) && (dMA+(MarketInfo(Symbol(),MODE_SPREAD)+iIndent)*Point>Ask+MarketInfo(Symbol(),MODE_STOPLEVEL)*Point))
         {
         if (!OrderModify(iTicket,OrderOpenPrice(),dMA+(MarketInfo(Symbol(),MODE_SPREAD)+iIndent)*Point,OrderTakeProfit(),OrderExpiration()))
         Print("Не удалось модифицировать стоплосс ордера №",OrderTicket(),". Ошибка: ",GetLastError());
         }
      }
   }
Returns 0, for crying out loud!!!
 




for(int cnt=0;cnt<OrdersTotal();cnt++){
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
iTicket=OrderTicket();
Comment("\nOrderTicket = ", iTicket);
// проверяем переданные значения
if ((iTicket==0) || ((iTmFrme!=1) && (iTmFrme!=5) && (iTmFrme!=15) && (iTmFrme!=30) && (iTmFrme!=60) && (iTmFrme!=240) && (iTmFrme!=1440) && (iTmFrme!=10080) && (iTmFrme!=43200)) || (iMAPeriod<2) || (MAMethod<0) || (MAMethod>3) || (iApplPrice<0) || (iApplPrice>6) || (iShift<0) || (iIndent<0))
{Comment("\nТрейлинг функцией TrailingByMA() невозможен из-за некорректности значений переданных ей аргументов."); return(0);}
// определим значение МА с переданными функции параметрами
double dMA = iMA(Symbol(),iTmFrme,iMAPeriod,iMAShift,MAMethod,iApplPrice,iShift);// значение скользящего среднего с переданными параметрами
// если длинная позиция, и её стоплосс хуже значения среднего с отступом в iIndent пунктов, модифицируем его
if (OrderType()==OP_BUY){
if ((OrderStopLoss()<dMA-iIndent*Point) && (dMA-iIndent*Point<Bid-MarketInfo(Symbol(),MODE_STOPLEVEL)*Point)){
if (!OrderModify(iTicket,OrderOpenPrice(),dMA-iIndent*Point,OrderTakeProfit(),OrderExpiration()))
Comment("Не удалось модифицировать стоплосс ордера №",OrderTicket(),". Ошибка: ",GetLastError());}}
// если позиция - короткая, и её стоплосс хуже (выше верхней границы канала или не определён, ==0), модифицируем его
if (OrderType()==OP_SELL){
if (((OrderStopLoss()==0) || (OrderStopLoss()>dMA+(MarketInfo(Symbol(),MODE_SPREAD)+iIndent)*Point)) && (dMA+(MarketInfo(Symbol(),MODE_SPREAD)+iIndent)*Point>Ask+MarketInfo(Symbol(),MODE_STOPLEVEL)*Point))
{if (!OrderModify(iTicket,OrderOpenPrice(),dMA+(MarketInfo(Symbol(),MODE_SPREAD)+iIndent)*Point,OrderTakeProfit(),OrderExpiration()))
Print("Не удалось модифицировать стоплосс ордера №",OrderTicket(),". Ошибка: ",GetLastError());}}}




Swetten , write if you need anything else.

 
meta-trader2007 писал (а) >>




Write if you need anything else.

Thank you very much! Only my fault - I had a higher cycle with return(0), so it was hiding and hurting me little by little.

I have a question: do you have a program, where I enter lot size, specify pair, and it shows me how much money (in rubles, for example) I need to buy this lot, point value, etc.?

Just every time you count, for example, 1.3 lots of GBPUSD, and then 2.8 lots of EURJPI gets a little tired.

 
Swetten писал (а) >>

Thank you very much! Only my fault - I had a higher cycle with return(0), so it was hiding and hurting me little by little.

I have a question: do you have a program, where I enter lot size, specify pair, and it shows me how much money (in rubles, for example) I need to buy this lot, point value, etc.?

Just every time you count for example 1.3 lot of GBPUSD, and then 2.8 lot of EURJPI, it gets a bit tiresome.

At GBPUSD, he smiled. At the EBUJPI, I went down with a patsy. I'm sorry, I don't mean anything bad by it.

 
And another question: there are three variables. Of any type. Is it possible to implement the following condition: if two variables out of three correspond to the condition so-and-so, then do so-and-so?
 
From
Swetten писал (а) >>
One more question: there are three variables. Of any type. Is it possible to implement the following condition: if two variables out of three correspond to the condition so-and-so, then do so-and-so?

bool a,b,c; //Переменные. True - удовлетворяют условию, False - не удовлетворяют.
int count; // Счетчик количества переменных, удовлетворяющих условию.
 
if(a==true)
 count++;
if(b==true)
 count++;
if(c==true)
 count++;
 
if(count>=2)
{
  //Делаем то-то
}

I advise to rename the topic to "Questions from Swetten" -)

 

on the subject =)

I've been using one of them seriously =) it's been going for two days now.

to practice, 200 quid.

for mts, a little more serious, 700 quid.

for long term mts from 7,000 quid

IMHO =)

 

Here's another good question: there's data like:

P1[a, b, step]

P2[c, d, step]

P3[e, f, step]

P4[g, h, step]

P5[i, j, step].

How can I write them in one go to a file and then read them from there?

I did it like this:

for(step = 1; step <= Dlina; stop++)
         {for(et = 1; it <= 20; et++)
             {for(i = 0; i <= min1 - 1; i++)
                 { FileWrite(file1, data0-0[i,it,stop]); 
                   FileWrite(file1, data0-1[i,it,stop]); 
                   FileWrite(file1, data0-2[i,it,stop]);
                   FileWrite(file1, data1-1[i,it,stop]); 
                   FileWrite(file1, data1-2[i,it,stop]); 
                   FileWrite(file1, data1-3[i,it,stop]);
                   FileWrite(file1, data2-0[i,it,stop]); 
                   FileWrite(file1, data2-1[i,it,stop]); 
                   FileWrite(file1, data2-2[i,it,stop]);
                   FileWrite(file1, data3-0[i,it,stop]); 
                   FileWrite(file1, data3-1[i,it,stop]); 
                   FileWrite(file1, data3-2[i,it,stop]);
                   FileWrite(file1, data4-1[i,it,stop]); 
                   FileWrite(file1, data4-2[i,it,stop]); 
                   FileWrite(file1, data4-3[i,it,stop]);
                 }
             }
         }
It's all wonderfully written, except it's all nonsense on the inside. The textbook is a bit of a bummer, really! And how do you write and read data like a table? And arrays like this? And in general? Kim's library has a look in it.
 
Swetten писал (а) >>

Thank you very much! Only my fault - I had a higher cycle with return(0), so it was hiding and hurting me little by little.

I have a question: do you have a program, where I enter lot size, specify pair, and it shows me how much money (in rubles, for example) I need to buy this lot, point value, etc.?

Just every time you count for example 1.3 lot of GBPUSD, and then 2.8 lots of EURJPI, it gets a bit tiresome.

There's a Trader's Calculator:)