Need a script for Excel research. Description. For 30 days from 8.00 to 12.00 every day to print in csv file print opening and closing price of candlesticks in this time interval.Period - on which the indicator put but not more than one hour.Indicator itself should not display anything and save in buffers.
How to make the cycles correct?
externint DayMax =30; //количество дней для печатиexternint DayStart =1; //начинаем с первого бараexternint HourStart =10; //время старта внутри дняexternint HourEnd =12; //время конца внутри дня//+------------------------------------------------------------------+//| Script program start function |//+------------------------------------------------------------------+voidOnStart()
{
//---int per=Period();
if(per>60)return; //если период больше часа , прекращаем работу скриптаdouble c_o=0,ABS_o_c=0;
for(int d=DayStart;d<=DayMax;d++)//перебираем дни от DayStart до DayMax, т.е с вчерашнего до 30
{
for(int h=0;h<60/per*24;h++) //перебираем бары с нолевого до последнего в сутках учитывая ТФ
{
if(Time[h]>HourStart && Time[h]<HourEnd)//проверка промежутка времени
{
//данные для печати и печать
c_o=(Close[h]-Open[h])*Point;
ABS_o_c=MathAbs(c_o);
f_PrintToFile(DayOfWeek(),TimeToString(TimeCurrent(),TIME_DATE|TIME_MINUTES),Open[h],Close[h],c_o,ABS_o_c);
Print(DayOfWeek(),TimeToString(TimeCurrent(),TIME_DATE|TIME_MINUTES),Open[h],Close[h],c_o,ABS_o_c);
}
}
}
}
//+------------------------------------------------------------------+// 1. В файл //+------------------------------------------------------------------+void f_PrintToFile(int f_DayOfWeek=0,
string f_TimeCurrent="",
double f_Open=0,
double f_Close=0,
double f_c_o=0,
double f_ABS_o_c=0)
{
string fileName=StringConcatenate(Symbol()," M",Period()," Tyrimas");
string FileType=".csv";
int handle;
handle=FileOpen(fileName+FileType,FILE_WRITE|FILE_READ,";");
if(handle!=INVALID_HANDLE)
{
FileSeek(handle,0,SEEK_END);
FileWrite(handle,f_DayOfWeek,f_TimeCurrent,f_Open,f_Close,f_c_o,f_ABS_o_c);
FileClose(handle);
}
}
I have doubts about the line because probably the loop does not understand the start of the day, and works with just a zero bar.
Help a novice programmer write a script to delete pending orders. All pending buy orders need to be deleted when there are no market positions and no pending sell orders.
I need to calculate the amount of possible losses on an order in the currency of the deposit. The task seems trivial. I have made a construction like this:
In most cases it calculates correctly. But I've found a symbol by which the calculation is wrong - HSI. Stubbornly counts not in deposit currency, but in something else (probably in yuan)
Need a script for Excel research.
Description.
For 30 days from 8.00 to 12.00 every day to print in csv file print opening and closing price of candlesticks in this time interval.Period - on which the indicator put but not more than one hour.Indicator itself should not display anything and save in buffers.
How to make the cycles correct?
I have doubts about the line because probably the loop does not understand the start of the day, and works with just a zero bar.
Help to understand.
Can you please tell me how to delete an object from the price chart from an indicator installed in a chart window?
The chart window always has an index of 0.
I apologise for cluttering up the whole page.
It's hard to attach the code correctly. There is a special SRC button in the editor
couldn't find it ((
In front of the video camera SRC to insert code!
Hello, I can't understand one thing.
I need to calculate the amount of possible losses on an order in the currency of the deposit. The task seems trivial. I have made a construction like this:
OrderSelect(vID, SELECT_BY_TICKET); vDepoLoss = (OrderStopLoss() - OrderOpenPrice()) / MarketInfo(OrderSymbol(), MODE_TICKSIZE) * MarketInfo(OrderSymbol(), MODE_TICKVALUE) * OrderLots();In most cases it calculates correctly. But I've found a symbol by which the calculation is wrong - HSI. Stubbornly counts not in deposit currency, but in something else (probably in yuan)