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

 
ALEX_SPB_RU:

I still don't get it!

Even if I explicitly specify that the search should start from zero position, the object named ya ya_Prefix_78 will be deleted , because the function will return number 4

Specifically, to delete by prefix, you must specify either ==0 or put !

No offense, I'm just learning, so I want to unpack everything for myself.

Thanks again for your help!

Good luck!

Maybe I didn't make it clear enough :

if(StringFind(name, prefix,0) == 0) is to search exclusively from the beginning of the string.

I don't like default parameters, unless they're handwritten functions - there's full control ....

Good luck.

 
abolk:

If you can call it a bummer, then a bummer. i would like to help someone in particular who needs help. but i know from experience, if someone is too lazy to understand their own task even a little, then helping is a total bummer...
Why is that? Is it possible to argue that it's faster and easier for a competent person to write code than for someone who just opened a textbook, who will make a few mistakes and then only get the right result? If you mean that I don't want to think about how to write, then logically I would immediately write the problem and ask to write one, but no, I want to understand myself, but not the whole language, but specifically my task
 
sergeev:

I wrote you specific function names.

I even showed you the algorithm for your actions.

Are you even too lazy to think about what you wrote?

I found only OrderModify, I couldn't find OrderOpenPrice , although I remember seeing it before. As for thinking, I thought that such a task belongs to boolean functions (I think if, then) in which to put what you have written. am I right?
 
Danil93:
I found only OrderModify, I couldn't find OrderOpenPrice , although I remember seeing it before. As for thinking, I thought that such a problem belongs to boolean functions (I think if, then) in which you need to write what you wrote. am I right?

Yes.

ok. if i give you a function that you want, can you at least paste it into the code yourself?

 
sergeev:

Yeah.

ok. if i give you the function you want, can you at least insert it into the code yourself?

i can
 

how to find the high between a certain date and another date programmatically.

There is a function that searches for a high by bar; I understand that it searches for a high from 0 bar to 4 bar; can I use the date and time of the bar instead of the bar?

For example, I can determine the date 2011.01.05 20:00 and find the bar (10 or 100 bars) and then paste it into the function of searching for the high?

iHigh(Symbol(),0,iHighest(NULL,0,MODE_HIGH,4,0)
 
Eliza:

how to find the high between a certain date and another date programmatically.

There is a function that searches for a high by bar; I understand that it searches for a high from 0 bar to 4 bar; can I use the date and time of the bar instead of the bar?

For example, I can determine the date 2011.01.05 20:00 and find the bar (10 or 100 bars) and then paste it into the function of searching for the high?


int iBarShift( string symbol, int timeframe, datetime time, bool exact=false) 
Поиск бара по времени. Функция возвращает смещение бара, которому принадлежит указанное время. 
Если для указанного времени бар отсутствует ("дыра" в истории), то функция возвращает, в зависимости 
от параметра exact, -1 или смещение ближайшего бара.

Параметры:
symbol   -   Символьное имя инструмента. NULL означает текущий символ. 
timeframe   -   Период. Может быть одним из периодов графика. 0 означает период текущего графика. 
time   -   Значение времени для поиска. 
exact   -   Возвращаемое значение если бар не найден. FALSE - iBarShift возвращает ближайший. 
            TRUE - iBarShift возвращает -1. 

Пример:
  datetime some_time=D'2004.03.21 12:00';
  int      shift=iBarShift("EUROUSD",PERIOD_M1,some_time);
  Print("shift of bar with open time ",TimeToStr(some_time)," is ",shift);

 
 
VladislavVG:

Thank you.)
 
Danil93:
can
//------------------------------------------------------------------ TralTP
void TralTP()
{
        int TS=20; // расстояние убытка, на котором переносим тейкпрофит на цену открытия
        
        double FreezLvl=MarketInfo(Symbol(), MODE_FREEZELEVEL)*Point; // расстояние заморозки ордера
        double StopLvl=MarketInfo(Symbol(), MODE_STOPLEVEL)*Point; // расстояние стопуровня ордера
        
        int n=OrdersTotal(); // число текущих открытых ордеров
        for (int i=0; i<n; i++) // проходим по всем ордерам и двигаем стоп
        {
                if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue; // берем ордер
                if (OrderSymbol()!=Symbol()) continue; // если ордер не нашей валюты, то пропускаем
                
                // берем его параметры
                int dir=OrderType(); double cop=NormalizeDouble(OrderOpenPrice(), Digits);
                double csl=NormalizeDouble(OrderStopLoss(), Digits); 
                double ctp=NormalizeDouble(OrderTakeProfit(), Digits);
                
                double apr; if (dir==OP_BUY) apr=Bid; else apr=Ask;
                // проверили уровень заморозки
                if (MathAbs(ctp-apr)<=FreezLvl || MathAbs(csl-apr)<=FreezLvl) continue; // если уровень заморозки
                
                double tp=cop; // ставим ТП на цену открытия
                
                // и проверяем условия выполнения отхода в убыток и правильность установки
                if ((dir==OP_BUY && cop-apr>=TS*Point && (tp<ctp || ctp==0) && tp>apr+StopLvl)
                 || (dir==OP_SELL && apr-cop>=TS*Point && (tp>ctp || ctp==0) && tp<apr-StopLvl))
                {
                        if (!OrderModify(OrderTicket(), cop, csl, tp, 0)) 
                                Print(GetLastError(), " -TralPos #"+OrderTicket()+" tp="+tp);
                }
        }
}
 


if (OrderSymbol()!=Symbol()) continue; // if the order is not our currency, then skip

I don't understand anything yet, I just entered the forum, I look for 15 seconds, but there is an error, I should write ==, at first glance, sorry if something is wrong.

Happy Holidays!!!Everyone!!!!

Reason: