[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 242

 
CYBOPOB:
Hi all, who can give me a hint? How to set the opening price of a pending Buy order relative to the MA and not the Ask price. For example, the candle closed near the MA, 7 points below or above the MA and the opening price of the order is fixed and should be MA+28p...? Thank you in advance.

OP_BUYSTOP pending order setting price:

double PriceSet = NormalizeDouble(Цена МАшки+28*Point, Digits);

Next, we need to check the setting price against the allowed StopLevel distance (OpenPrice-Ask StopLevel), i.e:

if (NormalizeDouble(Ask+StopLevel*Point-PriceSet, Digits)>0) PriceSet=Ask+StopLevel*Point;

If the setting price is less than Ask + the allowed order setting distance, make the setting price equal to the allowed distance
(there can be variations, depending on what you actually need)

StopLevel here:

MarketInfo(Symbol(),MODE_STOPLEVEL);

PriceSet - set price for pending BuyStop order

Somehow...

 
How do I get the process (expert, script, indicator) handle from the expert (script, indicator) itself?
 

How do I know the opening time (in seconds) from an open order ?

Thanks for the answers)
 
yellownight:
How do I know the opening time (in seconds) from an open order?

// до этого где-то OrderSelect
TimeToStr(OrderOpenTime(), TIME_SECONDS);// оно?
gyfto:
How to get the process (expert, script, indicator) handle from the expert (script, indicator) itself ?


Is it ok?

#import "kernel32.dll"
int GetModuleHandleA (string lpModuleName);//возвращает хэндл процесса; если lpModuleName=NULL то - текущего
#import

string lpModuleName;// неинициализированная строка содержит только /0, т.е. NULL
int hInstance;// передадим в CreateWindowExA

hInstance=GetModuleHandleA(lpModuleName);// аналогично GetModuleHandleA(NULL)
 
TarasBY:
I'm off the subject: calling an indicator out of itself - original!!!
" Ut-Fast oscillator-type indicator, prototype of the famous Ultra_Trend...."
Both of these famous indicators use an indicator call from itself.

It would be interesting to get an explanation if anyone is aware of it.

Unfortunately, I don't have the legal codes of the indicators.
 
gyfto:
yellownight:
How do I know the opening time ( in seconds) from an open order ?

// до этого где-то OrderSelect
TimeToStr(OrderOpenTime(), TIME_SECONDS);// оно?


Will this work?


You were asked in seconds and you converted it to a string
 
Vinin:

You were asked in seconds and you converted it to a string


Yeah spit on the conversions. Last time a few pages ago in this thread a person asked for Russian standard time, I took it literally and converted it (the MT output time standard is Chinese), which led to confusion. So I spit it out.

You can get it as the remainder of dividing datetime by 60:

int sec;// как по заказу
sec=OrderOpenTime()%60;// остаток от деления на 60
//ну и там дальше sec по назначению.

datetime is an int, so there shouldn't be any problems during compilation...

 
granit77:
" Ut-Fast indicator of the oscillator type, the prototype of the famous Ultra_Trend...."
Both of these famous indicators use an indicator call from itself.

It would be interesting to get an explanation if anyone is aware of it.

Unfortunately I don't have the legal codes for the indicators.

Me too, unfortunately. I looked at what I had at hand, and what immediately caught my eye was this design:

   int li_28 = key;
   if (li_28 == 34562458) loadJMAJMA();
   else {
   //---- какой-то код
            for (int li_40 = Len; li_40 <= Len + Progression * Sensitivity; li_40 += Progression) {
               g_icustom_572 = iCustom(NULL, 0, "ULTRA_TREND_VER2", 34562458, li_40, bars, X_Filtr, 0, l_index_36);
               g_icustom_580 = iCustom(NULL, 0, "ULTRA_TREND_VER2", 34562458, li_40, bars, X_Filtr, 0, l_index_36 + 1);
            }

I entered in the input parameters of the indicator the key mentioned in the conditions: 34562458. Here are pictures of both variants:

I presume that the indicator works in two modes:

  1. JMAJMA calculation; The
  2. oscillator itself.

The indicator calls "itself" in the 1st mode to calculate JMAJMA and then, based on these calculations, the oscillator is calculated. It's original! This method can increase the number of indicator buffers for calculations, not forgetting that there will be a limit for drawing.

 
i want to maximize the fit of the EA to my deposit. the problem is, in my DC the leverage is 1:500, but if i prescribe in the EA
Print(" Баланс счета = ",AccountBalance(), " плечо 1:",AccountLeverage());
I want to change leverage in my EA.
 
Increase the security deposit by the required amount and you'll be happy.