Игорь78 (Все сообщения пользователя)

Выбрать дату в календареВыбрать дату в календаре

Страницы: 1
Из таблицы "Состояние счета" пропала строка денег
 
Буквально с сегодня также отвалилось отображение счета депо - Сбер - QUIK 8.7.1.3 перепробовал все выше сказанное (UCAF), все бес толку, обновился до 9.4.2.1 (баланс появился) теперь нужные индикаторы отвалились и не работают (только стандартные), роботы встали. Как остаться работать на QUIK 8.7.1.3???
Индикатор Squeeze Momentum Indicator, Прошу помощи по перекодировки индикатора в луа для Квик
 
Добрый день. Искал пару месяцев, нашел только на МТ4 и МТ5 на луа его нигде нет.
Индикатор Squeeze Momentum Indicator, Прошу помощи по перекодировки индикатора в луа для Квик
 
Нашел код для МТ4

//+------------------------------------------------------------------+
//|                                      Created for MT4 by Ravish A |
//|                                                 Ravish Anandaram |
//|                                  mailto: aravishstocks@gmail.com |
//+------------------------------------------------------------------+
// ============================================================­===============================================
// This indicator is based on a strategy mentioned in John Carter's book, Mastering the Trade.
// It is also a fully improvised version of Squeeze_Break indicator by DesO'Regan.
// You can find that implementation here:
// https://www.mql5.com/en/code/8840?utm_campaign=MetaTrader+4+Terminal&utm_medium=special&...
// The main improvements include plotting squeeze values (some BB/KC calculation changes) on the zero-line and then to smoothen the momentum values as rising/falling positive/negative histograms
// to match the ones sold on commercial websites. This is easy on the eye.
// Uses some of the Linear Regression code fr om Victor Nicolaev aka Vinin's V_LRMA.mq4 for smoothening the histograms
// This version DOES NOT have any alerts functionality and also does not have inputs to change.
// The reason is - this is V1 and generally no body changes the BB and KC values. Feel free to enhance on your own.
// And if you like this indicator pa$$ :-) on to -->  Ravish Anandaram (aravishstocks@gmail.com)
// ============================================================­===============================================
#property copyright "Ravish Anandaram (aravishstocks@gmail.com)"
#property link      "mailto: aravishstocks@gmail.com"
//+------------------------------------------------------------------+
//| indicator properties                                             |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 6
#property indicator_color1 MediumBlue
#property indicator_color2 Tomato
#property indicator_color3 DodgerBlue
#property indicator_color4 Orange
#property indicator_color5 ForestGreen
#property indicator_color6 Red
//+------------------------------------------------------------------+
//| Buffer Array Declarations                                        |
//+------------------------------------------------------------------+
double Squeeze_Off[]; // Green Dots on the zero line
double Squeeze_On[]; // Red Dots on the zero line
double SqzFiredLong_Strong[]; // Rising Positive Histograms
double SqzFiredShort_Strong[]; // Falling Negative Histograms
double SqzFiredLong_Weak[]; // Falling Positive Histograms
double SqzFiredShort_Weak[]; // Rising Negative Histograms
//+------------------------------------------------------------------+
//| Internal Global Variables                                        |
//+------------------------------------------------------------------+
int       Bollinger_Period=20;
double    Bollinger_Deviation=2.0;
int       Keltner_Period=20;
double    Keltner_ATR=1.5;
int       Bollinger_MaMode=MODE_SMA;
int       Keltner_MaMode=MODE_SMA;
int       BarsToGoBack=1000;
int       Smooth_Factor=10;
double      LSmoothX=1.0;
double      LSmoothY=1.0;
double      LSmoothFactor_1=3.0;
double      LSmoothFactor_2=3.0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
 {
  IndicatorDigits(4);  // indicator value precision
//--- Indicator Setup
  SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,3);
  SetIndexBuffer(0,SqzFiredLong_Strong);
  SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,3);
  SetIndexBuffer(1,SqzFiredShort_Strong);
  SetIndexStyle(2,DRAW_HISTOGRAM,EMPTY,3);
  SetIndexBuffer(2,SqzFiredLong_Weak);
  SetIndexStyle(3,DRAW_HISTOGRAM,EMPTY,3);
  SetIndexBuffer(3,SqzFiredShort_Weak);
  SetIndexStyle(4,DRAW_HISTOGRAM,EMPTY,3);
  SetIndexBuffer(4,Squeeze_Off);
  SetIndexStyle(5,DRAW_HISTOGRAM,EMPTY,3);
  SetIndexBuffer(5,Squeeze_On);
//--- Indicator Labels
  IndicatorShortName("Squeeze RA V1");
//---
  return(0);
 }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
 {
  ObjectsDeleteAll();
  return(0);
 }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double GetSmoothenedValuesForHistograms(int nShift,int nLength)
 {
  double LSmooth1,LSmooth2,LSmoothVal;
  LSmooth1=LSmoothX*iMA(Symbol(),0,nLength,0,MODE_SMA,PRICE_CLOSE,nShift);
  LSmooth2=iMA(Symbol(),0,nLength,0,MODE_LWMA,PRICE_CLOSE,nShift)/LSmoothY;
  LSmoothVal=LSmoothFactor_1*LSmooth2-LSmoothFactor_2*LSmooth1;
  return LSmoothVal*Smooth_Factor;
 }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
 {
//--- Indicator Optimization
  int Counted_Bars=IndicatorCounted();
  if(Counted_Bars < 0) return -1;
  if(Counted_Bars>0) Counted_Bars=Counted_Bars-Keltner_Period;
  int limit=Bars-Counted_Bars;
  int lim it2=0;
//---
  if(_Period==PERIOD_MN1)
     Smooth_Factor= 4;
  else if(_Period == PERIOD_W1)
     Smooth_Factor= 4;
  else if(_Period == PERIOD_D1)
     Smooth_Factor= 6;
  else if(_Period == PERIOD_H4)
     Smooth_Factor= 8;
  else if(_Period == PERIOD_H1)
     Smooth_Factor= 30;
  else if(_Period == PERIOD_M30)
     Smooth_Factor= 50;
  else if(_Period == PERIOD_M15)
     Smooth_Factor= 50;
  else if(_Period == PERIOD_M5)
     Smooth_Factor= 100;
  else if(_Period == PERIOD_M1)
     Smooth_Factor= 300;
//--- Main Indicator Loop
  for(int i=limit-2; i>=limit2; i--) //main indicator FOR loop
    {
     //--- Indicator Calculations
     double Kelt_Mid_Band=iMA(Symbol(),0,Keltner_Period,0,Keltner_MaMode,PRICE_CLOSE,i);
     double Kelt_Upper_Band = Kelt_Mid_Band + (iATR(Symbol(),0,Keltner_Period,i)*Keltner_ATR);
     double Kelt_Lower_Band = Kelt_Mid_Band - (iATR(Symbol(),0,Keltner_Period,i)*Keltner_ATR);
     //---
     double StdDev=iStdDev(Symbol(),0,Bollinger_Period,0,Bollinger_MaMode,PRICE_CLOSE,i);
     double Ma=iMA(Symbol(),0,Bollinger_Period,0,Bollinger_MaMode,PRICE_CLOSE,i);
     double Boll_Upper_Band = Ma + (StdDev*Bollinger_Deviation);
     double Boll_Lower_Band = Ma - (StdDev*Bollinger_Deviation);
     //---
     double dLSmoothVal=0;
     //--- Buffer Calculations
     //--- Smoothen the histogram bars using linear reg methods
     dLSmoothVal=GetSmoothenedValuesForHistograms(i,Keltner_Period);
     if(dLSmoothVal>0)
       {
        if((SqzFiredLong_Strong[i+1]!=0 && dLSmoothVal>SqzFiredLong_Strong[i+1]) || (SqzFiredLong_Weak[i+1]!=0 && dLSmoothVal>SqzFiredLong_Weak[i+1]))
          {
           SqzFiredLong_Strong[i]=dLSmoothVal;
           SqzFiredLong_Weak[i]=0;
          }
        else
          {
           SqzFiredLong_Weak[i]=dLSmoothVal;
           SqzFiredLong_Strong[i]=0;
          }
        SqzFiredShort_Strong[i]=0;
        SqzFiredShort_Weak[i]=0;
       }
     else
       {
        if((SqzFiredShort_Strong[i+1]!=0 && dLSmoothVal<SqzFiredShort_Strong[i+1]) || (SqzFiredShort_Weak[i+1]!=0 && dLSmoothVal<SqzFiredShort_Weak[i+1]))
          {
           SqzFiredShort_Strong[i]=dLSmoothVal;
           SqzFiredShort_Weak[i]=0;
          }
        else
          {
           SqzFiredShort_Weak[i]=dLSmoothVal;
           SqzFiredShort_Strong[i]=0;
          }
        SqzFiredLong_Strong[i]=0;
        SqzFiredLong_Weak[i]=0;
       }
     //---
     if(Boll_Upper_Band<Kelt_Upper_Band && Boll_Lower_Band>Kelt_Lower_Band)
       {
        Squeeze_On[i]=0.01;
        Squeeze_Off[i]=0;
       }
     else
       {
        Squeeze_Off[i]= 0.01;
        Squeeze_On[i] = 0;
       }
    } // end of main indicator FOR loop
//---
  return(0);
 }
//+------------------------------------------------------------------+
Индикатор Squeeze Momentum Indicator, Прошу помощи по перекодировки индикатора в луа для Квик
 
Конечно если у кого есть я был бы крайне благодарен. Если нет, готов заплатить за перекодировку для луа.
Индикатор Squeeze Momentum Indicator, Прошу помощи по перекодировки индикатора в луа для Квик
 
Для МТ5 нашел следующий код.

   
 
//+------------------------------------------------------------------+
//|                                             Squeeze_Momentum.mq5 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                                                 https://mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://mql5.com&quot;
#property version   "1.00"
#property description "Squeeze Momentum indicator"
#property indicator_separate_window
#property indicator_buffers 9
#property indicator_plots   2
//--- plot UP
#property indicator_label1  "SqMom Up"
#property indicator_type1   DRAW_HISTOGRAM
#property indicator_color1  clrGreen
#property indicator_style1  STYLE_SOLID
#property indicator_width1  8
//--- plot DN
#property indicator_label2  "SqMom Down"
#property indicator_type2   DRAW_HISTOGRAM
#property indicator_color2  clrRed
#property indicator_style2  STYLE_SOLID
#property indicator_width2  8
//--- input parameters
input uint     InpPeriod   =  20;   // Period
//--- indicator buffers
double         BufferUP[];
double         BufferDN[];
double         BufferRaw[];
double         BufferLRL[];
double         BufferLocalExUP[];
double         BufferLocalExDN[];
double         BufferCloseLocalUP[];
double         BufferCloseLocalDN[];
double         BufferMA[];
//--- global variables
int            period;
int            handle_ma;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
 {
//--- set global variables
  period=int(InpPeriod<1 ? 1 : InpPeriod);
//--- indicator buffers mapping
  SetIndexBuffer(0,BufferUP,INDICATOR_DATA);
  SetIndexBuffer(1,BufferDN,INDICATOR_DATA);
  SetIndexBuffer(2,BufferRaw,INDICATOR_CALCULATIONS);
  SetIndexBuffer(3,BufferLRL,INDICATOR_CALCULATIONS);
  SetIndexBuffer(4,BufferLocalExUP,INDICATOR_CALCULATIONS);
  SetIndexBuffer(5,BufferLocalExDN,INDICATOR_CALCULATIONS);
  SetIndexBuffer(6,BufferCloseLocalUP,INDICATOR_CALCULATIONS);
  SetIndexBuffer(7,BufferCloseLocalDN,INDICATOR_CALCULATIONS);
  SetIndexBuffer(8,BufferMA,INDICATOR_CALCULATIONS);
//--- setting buffer arrays as timeseries
  ArraySetAsSeries(BufferUP,true);
  ArraySetAsSeries(BufferDN,true);
  ArraySetAsSeries(BufferRaw,true);
  ArraySetAsSeries(BufferLRL,true);
  ArraySetAsSeries(BufferLocalExUP,true);
  ArraySetAsSeries(BufferLocalExDN,true);
  ArraySetAsSeries(BufferCloseLocalUP,true);
  ArraySetAsSeries(BufferCloseLocalDN,true);
  ArraySetAsSeries(BufferMA,true);
//--- setting indicator parameters
  IndicatorSetString(INDICATOR_SHORTNAME,"Squeeze Momentum");
  IndicatorSetInteger(INDICATOR_DIGITS,0);
//--- create MA's handles
  ResetLastError();
  handle_ma=iMA(NULL,PERIOD_CURRENT,period,0,MODE_SMA,PRICE_CLOSE);
  if(handle_ma==INVALID_HANDLE)
    {
     Print("The iMA(",(string)period,") object was not created: Error ",GetLastError());
     return INIT_FAILED;
    }
//---
  return(INIT_SUCCEEDED);
 }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
               const int prev_calculated,
               const datetime &time[],
               const double &open[],
               const double &high[],
               const double &low[],
               const double &close[],
               const long &tick_volume[],
               const long &volume[],
               const int &spread[])
 {
//--- Установка массивов буферов как таймсерий
  ArraySetAsSeries(open,true);
  ArraySetAsSeries(high,true);
  ArraySetAsSeries(low,true);
  ArraySetAsSeries(close,true);
  ArraySetAsSeries(time,true);
//--- Проверка количества доступных баров
  if(rates_total<fmax(period,4)) return 0;
//--- Проверка и расчёт количества просчитываемых баров
  int limit=rates_total-prev_calculated;
  if(limit>1)
    {
     limit=rates_total-period-3;
     ArrayInitialize(BufferUP,EMPTY_VALUE);
     ArrayInitialize(BufferDN,EMPTY_VALUE);
     ArrayInitialize(BufferRaw,0);
     ArrayInitialize(BufferLRL,0);
     ArrayInitialize(BufferLocalExUP,0);
     ArrayInitialize(BufferLocalExDN,0);
     ArrayInitialize(BufferCloseLocalUP,0);
     ArrayInitialize(BufferCloseLocalDN,0);
     ArrayInitialize(BufferMA,0);
    }
//--- Подготовка данных
  int count=(limit>1 ? rates_total : 1),copied=0;
  copied=CopyBuffer(handle_ma,0,0,count,BufferMA);
  if(copied!=count) return 0;
  for(int i=limit; i>=0 && !IsStopped(); i--)
    {
     double Median=(high[i]+low[i])/2.0;
     BufferRaw[i]=close[i]-((Median+BufferMA[i])/2.0);
    }
  for(int i=limit; i>=0 && !IsStopped(); i--)
    {
     double x=0,y=0,xy=0,x2=0;
     for(int j=0;j<period;j++)
       {
        y+=BufferRaw[i+j];
        xy+=BufferRaw[i+j]*j;
        x+=j;
        x2+=j*j;
       }
     double tmp=period*x2-x*x;
     double m=(period*xy-x*y)/(tmp!=0 ? tmp : 1.0);
     double yint=(y+m*x)/period;
     BufferLRL[i]=yint-m*period;
    }
 
//--- Расчёт индикатора
  for(int i=limit; i>=0 && !IsStopped(); i--)
    {
     if((BufferLRL[i]>0) && (BufferLRL[i]<BufferLRL[i+1]) && (BufferLRL[i+1]>BufferLRL[i+2]))
        BufferLocalExUP[i]=BufferLRL[i];
     else
        BufferLocalExUP[i]=BufferLocalExUP[i+1];

     if((BufferLRL[i]>0) && (BufferLRL[i]<BufferLRL[i+1]) && (BufferLRL[i+1]>BufferLRL[i+2]))
        BufferCloseLocalUP[i]=close[i];
     else
        BufferCloseLocalUP[i]=BufferCloseLocalUP[i+1];

     if((BufferLRL[i]<0) && (BufferLRL[i]>BufferLRL[i+1]) && (BufferLRL[i+1]<BufferLRL[i+2]))
        BufferLocalExDN[i]=BufferLRL[i];
     else
        BufferLocalExDN[i]=BufferLocalExDN[i+1];

     if((BufferLRL[i]<0) && (BufferLRL[i]>BufferLRL[i+1]) && (BufferLRL[i+1]<BufferLRL[i+2]))
        BufferCloseLocalDN[i]=close[i];
     else
        BufferCloseLocalDN[i]=BufferCloseLocalDN[i+1];

     bool dn_sg=((BufferCloseLocalUP[i]>BufferCloseLocalUP[i+1]) && (BufferLocalExUP[i+1]>BufferLocalExUP[i]) ? true : false);
     bool dn_sg_custom=((BufferCloseLocalDN[i]>BufferCloseLocalDN[i+1]) && (BufferLocalExDN[i+1]>BufferLocalExDN[i]) ? true : false);
     bool up_sg=((BufferCloseLocalDN[i]<BufferCloseLocalDN[i+1]) && (BufferLocalExDN[i+1]<BufferLocalExDN[i]) ? true : false);
     bool up_sg_custom=((BufferCloseLocalUP[i]<BufferCloseLocalUP[i+1]) && (BufferLocalExUP[i+1]<BufferLocalExUP[i]) ? true : false);
     
     BufferUP[i]=((dn_sg || dn_sg_custom || up_sg || up_sg_custom) && (BufferLRL[i]>BufferLRL[i+1]) ? 1 : 0);
     BufferDN[i]=((dn_sg || dn_sg_custom || up_sg || up_sg_custom) && (BufferLRL[i]<BufferLRL[i+1]) ? 1 : 0);
    }
 
//--- return value of prev_calculated for next call
  return(rates_total);
 }
//+------------------------------------------------------------------+
Индикатор Squeeze Momentum Indicator, Прошу помощи по перекодировки индикатора в луа для Квик
 
Добрый вечер. Признаю опыта программирования у меня нет вообще, очень понравился всем известный индикатор Squeeze Momentum Indicator, даже нашел версию для МТ4, но вот для Квик сколько не искал всё бестолку. Прошу помочь перекодить его для квик. Прилагаю код из трейдингвью. С большим уважением к Вам.

//
study(shorttitle = "SQZMOM_LB", title="Squeeze Momentum Indicator [LazyBear]", overlay=false)

length = input(20, title="BB Length")
mult = input(2.0,title="BB MultFactor")
lengthKC=input(20, title="KC Length")
multKC = input(1.5, title="KC MultFactor")

useTrueRange = input(true, title="Use TrueRange (KC)", type=bool)

// Calculate BB
source = close
basis = sma(source, length)
dev = multKC * stdev(source, length)
upperBB = basis + dev
lowerBB = basis - dev

// Calculate KC
ma = sma(source, lengthKC)
range = useTrueRange ? tr : (high - low)
rangema = sma(range, lengthKC)
upperKC = ma + rangema * multKC
lowerKC = ma - rangema * multKC

sqzOn  = (lowerBB > lowerKC) and (upperBB < upperKC)
sqzOff = (lowerBB < lowerKC) and (upperBB > upperKC)
noSqz  = (sqzOn == false) and (sqzOff == false)

val = linreg(source  -  avg(avg(highest(high, lengthKC), lowest(low, lengthKC)),sma(close,lengthKC)),
           lengthKC,0)

bcolor = iff( val > 0,
           iff( val > nz(val[1]), lime, green),
           iff( val < nz(val[1]), red, maroon))
scolor = noSqz ? blue : sqzOn ? black : gray
plot(val, color=bcolor, st yle=histogram, linewidth=4)
plot(0, color=scolor, st yle=cross, linewidth=2)
Страницы: 1
Наверх