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

 
SpikeOne:


well, yeah. You can check it yourself=) set the amount above 700 dollars and test it=) 5 minute interval

You could also modify it and make it start every night by itself=)


I see))) Well good luck then in conquering the profitable heights))
 

Hello.

If i've tried it this way, i've had a problem with it, but i have never found it... If i've tried it this way, the order will put the value of the previous bar as a TakeProfit... I tried it both ways... The order never sees the variable and skips it... As a result, TP is set to 0 or 1 or 2...

tried everything that came into my head does not work.... The most not clear If I replace "TP =" with Print it writes everything... Help a beginner.... I will be very grateful.

OrderSend(Symbol(), OP_BUY, 0.1, Ask, 50, 0, (Ask +((High[1]-Low[1])*3)*Point), "", 123, 0, Blue);

_______________________________________________________________________________________

for (int i=1;i<=1;i++)

TP = ((High[i]- Low[i])*3);

OrderSend(Symbol(), OP_BUY, 0.1, Ask, 50, 0, Ask + TP*Point, "", 123, 0, Blue);

____________________________________________________________________________________________

 
PaMyC:

Hello.

If i've tried it this way, i've had a problem with it, but i have never found it... If i've tried it this way, the order will put the value of the previous bar as a TakeProfit... I tried it both ways... The order never sees the variable and skips it... As a result, TP is set to 0 or 1 or 2...

tried everything that came to mind does not work.... The most not clear If I replace "TP =" with Print it writes everything... Help a beginner.... I will be very grateful.

OrderSend(Symbol(), OP_BUY, 0.1, Ask, 50, 0, (Ask +((High[1]-Low[1])*3)*Point), "", 123, 0, Blue);

_______________________________________________________________________________________

for (int i=1;i<=1;i++)

TP = ((High[i]- Low[i])*3);

OrderSend(Symbol(), OP_BUY, 0.1, Ask, 50, 0, Ask + TP*Point, "", 123, 0, Blue);

____________________________________________________________________________________________



The thp in OrderSend() is not the number of points, but the price at which the order will be closed, and when you set the thp it is necessary to remember about the level of freezing (each DTZ has its own problems).

might be useful, thanks Artem.

artmedia70 15.12.2013 22:34 #

There's also an unaccounted StopLevel. If you do not know it, it may be equal to zero and then it is calculated differently. In Alpari, for example, it is always zero, but there are limits and they are counted as spread*2

So, first define the StopLevel:

Globally:

int level=0, sp=0;

Then in start() :

   sp=MarketInfo(sy,MODE_SPREAD);
//-------------- Проверка StopLevel ---------------
   level=MarketInfo(sy,MODE_STOPLEVEL );           // Значение уровня установки стопов
   if (level==0) level=sp*2;

And then already compare the size of the stop order with the received level and use the calculated correct values for stop orders:

//+----------------------------------------------------------------------------+
   double pa=MarketInfo(Symbol(),MODE_ASK),  // цена Ask
          pb=MarketInfo(Symbol(),MODE_BID),  // цена Bid
          sl=0, tp=0;
   if(OrderType()==OP_BUY) {
      sl=NormalizeDouble(MathMin(pb-StopLoss*Point,pb-(level+1)*Point),Digits);
      tp=NormalizeDouble(MathMax(pb+TakeProfit*Point,pb+(level+1)*Point),Digits);
      // далее используем полученные уровни 
      // sl для цены StopLoss 
      // и tp для цены TakeProfit
      }
   if(OrderType()==OP_SELL) {
      sl=NormalizeDouble(MathMax(pa+StopLoss*Point,pa+(level+1)*Point),Digits());
      tp=NormalizeDouble(MathMin(pa-TakeProfit*Point,pa-(level+1)*Point),Digits());
      // далее используем полученные уровни 
      // sl для цены StopLoss 
      // и tp для цены TakeProfit
      }
//+----------------------------------------------------------------------------+

 

I didn't just have items in my code either, I had a price value...

I think I understand what your code says, but how it should help...?

 
PaMyC:

I didn't just have items in my code either, I had a price value...

I think I understand what's written in your code but how it should help...?


explain

given:

Low=1.3674

High=1.3811

Ask=1.3734

Your calculations:

Ask +((High[1]-Low[1])*3)*Point = 1.3734+((1.3811-1.3674)*3)*Point = 1.3734+(0.0137*3)*Point = 1.3734+(0.0411)*Point = 1.3734+411 = 412.3734 - does not seem like a good quote to me)

just remove the multiplication by the point and that's it)

 
PaMyC:

I didn't just have items in my code either, I had a price value...

I think I understand what your code says, but how it should help...?


You can print TP normally, but when you place an order, you multiply it by a point and mess everything up...
 
PaMyC:

I didn't just have items in my code either, I had a price value...

I think I understand what your code says, but how it should help...?


Or maybe it's not a big number, but rather a very small one, that's why you set the TP to 0 or 1.
 
vadynik:
Can you tell me how to make a virtual trailing, how to replace OrderModify() ?


I have a block with trailing for a robot, both normal and my own specific one (for news movements)

I can send it to you, but it's up to you.)

 
Ekburg:

You print the TP normally, but in placing the order you, again, multiply by the point and mess everything up...


Thanks so much it helped), just removed the point and miracles all done))))

As I thought the error was very small, but so nasty...

 
vadynik:
Can you tell me how to make a virtual trailing, how to replace OrderModify() ?
Ready solution (for virtual STOPs). Virtual trailing in b-PSI@Trail_Stairs library in this EA.