Sayfa 589/593 İlkİlk ... 89489539579587588589590591 ... SonSon
Arama sonucu : 4740 madde; 4,705 - 4,712 arası.

Konu: İDEAL veri terminalinde /Sistem/İndikatör/Robot

  1. #4705
    Duhul
    Feb 2017
    İkamet
    Eskişehir / Duhul 2007
    Yaş
    53
    Gönderi
    4,631
     Alıntı Originally Posted by engin.kilic.73 Yazıyı Oku
    abi teşekkür ederim cevabınız için.

    Al koşulu : rsı > 60 iken stok :max 40 olur
    her rsı >rsi-1 de 1 lot alsın
    her rsı <rsi-1 de 1 lot satsın. ( bu kısımda 1 lot satmıyor abi - direk flat şartına geçiyor.)

    rsı < 40 ise flat olsun (hepsi flat.a geçer)

    şeklinde yapmaya çalıştık.

    demek ki ne yapması gerektiğini robota anlatamıyorsunuz.

    kademeli alım -satım robotları diğerlerine göre (çift yön ) biraz daha karışıktır.


    alt tarafı bir tost yapmak için bile ne kadar detay gerekiyor. izleyin.

    Bear_Bull
    @BearBull26

  2. #4706
    Duhul
    Feb 2017
    İkamet
    Eskişehir / Duhul 2007
    Yaş
    53
    Gönderi
    4,631
     Alıntı Originally Posted by Bear_Bull Yazıyı Oku
    else if (RSI[i-1] > 60 && RSI[i] <= 60 && RSI[i] < RSI[i-1] ) //SAT KOŞULU
    SonYon = "S";
    Sistem.Yon[i] = "S";
    Miktar = 1;
    Bear_Bull
    @BearBull26

  3.  Alıntı Originally Posted by hsynymk Yazıyı Oku
    Buyrun VWAP ve Pivot

    Kod:
                var gV    = Sistem.GrafikVerileriniOku( Sistem.Sembol, "G");  
    	    var V     = Sistem.GrafikVerileri;
    	    var O     = Sistem.GrafikFiyatSec("Acilis");
    	    var H     = Sistem.GrafikFiyatSec("Yuksek");
    	    var L     = Sistem.GrafikFiyatSec("Dusuk");
    	    var C     = Sistem.GrafikFiyatSec("Kapanis");
    
    
                var TipikFiyat = Sistem.GrafikFiyatSec("Tipik" );
                var Lot        = Sistem.GrafikFiyatSec("Lot");
    
    
    
    
    //          =============================  vWAP  Periyot  ========================================================        
               // int Len                 = Sistem.Parametreler[0].Length ;
               // Len                     = Len - 13; 
               // String lv_VWAP_Periyot  = Sistem.Parametreler[0].Substring(13, Len);
               // var vwV_tmp             = Sistem.GrafikVerileriniOku(Sistem.Sembol, lv_VWAP_Periyot );
               // var vwV                 = Sistem.DonemCevir(V, vwV_tmp , vwV_tmp);  // DonemCevir(Veriler, UstDonemVerileri, UstDonemCevrilecekData)
    
    
    //          =============================  vWAP ================================================================= 
                var Lot_Fiyat        = Sistem.Liste(0); 
                var Sum_Lot_Fiyat    = Sistem.Liste(0); 
                var VWAP             = Sistem.Liste(0);
                var Sum_Lot          = Sistem.Liste(0); 
               
                var R1               = Sistem.Liste(V.Count, 0.0f);
                var R2               = Sistem.Liste(V.Count, 0.0f);
              //  var R3               = Sistem.Liste(V.Count, 0);
                var S1               = Sistem.Liste(V.Count, 0.0f);
                var S2               = Sistem.Liste(V.Count, 0.0f);
              //  var S3               = Sistem.Liste(V.Count, 0);
                var sq               = Sistem.Liste(V.Count, 0.0f);
                var sqr              = Sistem.Liste(V.Count, 0.0f);
    
    
                var vwG              = Sistem.Liste(gV.Count, 0.0f);
    
    
                 
    
    
                for(int i= 5; i < Sistem.BarSayisi; i++) 
                {
                  // Her gün için yeniden hesaplasın
    	         if ( V[i].Date.Day != V[i-1].Date.Day  )
    		 {
                        Lot_Fiyat[i]       = Lot[i] * TipikFiyat[i]; 
                        Sum_Lot_Fiyat[i]   = Lot_Fiyat[i] ; 
                        Sum_Lot[i]         = Lot[i];
                        VWAP[i]            = ( Sum_Lot_Fiyat[i] / Sum_Lot[i] );
                        sq[i]              =  Lot[i] * ( TipikFiyat[i] ) * ( TipikFiyat[i] - VWAP[i] );
                     }
                     else
                     {
                        Lot_Fiyat[i]       = Lot[i] * TipikFiyat[i]; 
                        Sum_Lot_Fiyat[i]   = Sum_Lot_Fiyat[i-1]  + Lot_Fiyat[i] ; 
                        Sum_Lot[i]         = Sum_Lot[i-1] + Lot[i];
                        VWAP[i]            = ( Sum_Lot_Fiyat[i] / Sum_Lot[i] );
                        sq[i]              =  sq[i-1] + Lot[i] * ( TipikFiyat[i] - VWAP[i-1] ) * ( TipikFiyat[i] - VWAP[i] );
                    }
     
    //              https://www.tradingview.com/script/EaBACrDi/
    //              fib1 = input(title="Fibo extension 1", type=input.float, defval=1.618)
    //              fib2 = input(title="Fibo extension 2", type=input.float, defval=2.618)
    
    
    //              t = time(reso)
    //              debut = na(t[1]) or t > t[1]
    
    
    //              addsource = hlc3 * volume
    //              addvol = volume
    //              addsource := debut ? addsource : addsource + addsource[1]
    //              addvol := debut ? addvol : addvol + addvol[1]
    //              VWAP = addsource / addvol
    
    
    //              sn = 0.0
    //              sn := debut ? sn : sn[1] + volume * (hlc3 - VWAP[1]) * (hlc3 - VWAP)
    //              sd = sqrt(sn / addvol)
    
    
    //             Fibp2 = VWAP + fib2 * sd
    //             Fibp1 = VWAP + fib1 * sd
    //             Fibm1 = VWAP - fib1 * sd
    //             Fibm2 = VWAP - fib2 * sd
    
    
                   
                   sqr[i] = (float)Math.Sqrt( sq[i] / Sum_Lot[i] ); 
    
    
                   R2[i]  =  VWAP[i] + 2.618f * sqr[i];
                   R1[i]  =  VWAP[i] + 1.618f * sqr[i] ;
    
    
                   S1[i]  =  VWAP[i] - 1.618f * sqr[i];
                   S2[i]  =  VWAP[i] - 2.618f * sqr[i] ;
                    
                   Sistem.Debug( Lot[i].ToString() );
                     
                }
    //          ===============================================================================================  
    
    
                  var gHigh      = Sistem.Liste(V.Count, 0);
                  var gLow       = Sistem.Liste(V.Count, 0);
                  var gC         = Sistem.Liste(V.Count, 0);
                  var gO         = Sistem.Liste(V.Count, 0);
    
    
    
    
                  var pivot      = Sistem.Liste(V.Count, 0);
                  var buy_line   = Sistem.Liste(V.Count, 0);
                  var sell_line  = Sistem.Liste(V.Count, 0);
    
    
                  var pR5         = Sistem.Liste(V.Count, 0);
                  var pR4         = Sistem.Liste(V.Count, 0);
                  var pR3         = Sistem.Liste(V.Count, 0);
                  var pR2         = Sistem.Liste(V.Count, 0);
                  var pR1         = Sistem.Liste(V.Count, 0);
                  var pPP         = Sistem.Liste(V.Count, 0);
                  var pS1         = Sistem.Liste(V.Count, 0);
                  var pS2         = Sistem.Liste(V.Count, 0);
                  var pS3         = Sistem.Liste(V.Count, 0);
                  var pS4         = Sistem.Liste(V.Count, 0);
                  var pS5         = Sistem.Liste(V.Count, 0);
    
    
                  var uC   = Sistem.GrafikFiyatOku(gV, "Kapanis") ;
                  var uH   = Sistem.GrafikFiyatOku(gV, "Yuksek") ;
                  var uL   = Sistem.GrafikFiyatOku(gV, "Dusuk") ;
                  var uO   = Sistem.GrafikFiyatOku(gV, "Acilis") ;
    
    
                  var gP3_tmp  = Sistem.Liste(gV.Count, 0);
    
    
                  gHigh = Sistem.DonemCevir(V, gV, Sistem.Ref(uH, -1 ) );  
                  gLow  = Sistem.DonemCevir(V, gV, Sistem.Ref(uL, -1 ) );  
                  gC    = Sistem.DonemCevir(V, gV, Sistem.Ref(uC, -1 ) );  
                  gO    = Sistem.DonemCevir(V, gV, Sistem.Ref(uO, -1 ) );  
    
    
                  for (int i = 5; i < Sistem.BarSayisi  ; i++)
                  {
    //                  Traditional Pivot Noktaları
                        if ( V[i].Date.DayOfYear == V[V.Count-1].Date.DayOfYear  )
    		    {
    
    
                            pPP[i] = (gHigh[i]  + gLow[i]  +  gC[i]) / 3.0f;
                            pR1[i] = pPP[i] * 2 - gLow[i] ;
                            pS1[i] = pPP[i] * 2 - gHigh[i];
                            pR2[i] = pPP[i] + (gHigh[i] - gLow[i] );
                            pS2[i] = pPP[i] - (gHigh[i] - gLow[i] );
                            pR3[i] = pPP[i] * 2 + (gHigh[i] - 2 * gLow[i] );
                            pS3[i] = pPP[i] * 2 - (2 * gHigh[i] - gLow[i] );
                            pR4[i] = pPP[i] * 3 + (gHigh[i] - 3 * gLow[i] );
                            pS4[i] = pPP[i] * 3 - (3 * gHigh[i] - gLow[i] );
                            pR5[i] = pPP[i] * 4 + (gHigh[i] - 4 * gLow[i] );
                            pS5[i] = pPP[i] * 4 - (4 * gHigh[i] - gLow[i] )  ; 
    
    
                       }
                 }
    
    
    //         ===============================================================================================
    
    
               Sistem.Cizgiler[0].Deger       = VWAP;
    	   Sistem.Cizgiler[0].Aciklama    = "VWAP";
     
               Sistem.Cizgiler[1].Deger       = Lot_Fiyat;
    	   Sistem.Cizgiler[1].Aciklama    = "Lot x Fiyat";
     
               Sistem.Cizgiler[4].Deger       = R1;
    	   Sistem.Cizgiler[4].Aciklama    = "R1";
     
               Sistem.Cizgiler[5].Deger       = R2;
    	   Sistem.Cizgiler[5].Aciklama    = "R2";
    	    
               Sistem.Cizgiler[6].Deger       = S1;
    	   Sistem.Cizgiler[6].Aciklama    = "S1";
    	    
               Sistem.Cizgiler[7].Deger       = S2;
    	   Sistem.Cizgiler[7].Aciklama    = "S2";
    	    
               Sistem.Cizgiler[11].Deger       = pR1;
               Sistem.Cizgiler[11].Aciklama    = "R1";
               Sistem.Cizgiler[12].Deger       = pR2;
               Sistem.Cizgiler[12].Aciklama    = "R2";
               Sistem.Cizgiler[13].Deger       = pR3;
               Sistem.Cizgiler[13].Aciklama    = "R3";
               Sistem.Cizgiler[14].Deger       = pR4;
               Sistem.Cizgiler[14].Aciklama    = "R4";
               Sistem.Cizgiler[15].Deger       = pR5;
               Sistem.Cizgiler[15].Aciklama    = "R5";
    
    
    
    
               Sistem.Cizgiler[16].Deger       = pS1;
               Sistem.Cizgiler[16].Aciklama    = "S1";
               Sistem.Cizgiler[17].Deger       = pS2;
               Sistem.Cizgiler[17].Aciklama    = "S2";
               Sistem.Cizgiler[18].Deger       = pS3;
               Sistem.Cizgiler[18].Aciklama    = "S3";
               Sistem.Cizgiler[19].Deger       = pS4;
               Sistem.Cizgiler[19].Aciklama    = "S4";
               Sistem.Cizgiler[20].Deger       = pS5;
               Sistem.Cizgiler[20].Aciklama    = "S5";
    
    
               Sistem.Cizgiler[21].Deger       = pPP;
               Sistem.Cizgiler[21].Aciklama    = "PP";
    
    
               Sistem.Cizgiler[22].Deger       = Lot;
               Sistem.Cizgiler[22].Aciklama    = "Lot";
    
    
    
    
             //  Sistem.DolguEkle(4, 5, Color.FromArgb(80, 200, 200, 200), Color.FromArgb(80, 200, 200, 200));
             //  Sistem.DolguEkle(6, 7, Color.FromArgb(80, 200, 200, 200), Color.FromArgb(80, 200, 200, 200));
    
    
    
    
              //==================================================================================================
              //Pivot text      
                              
              Sistem.YaziEkle("R1", 1, Sistem.BarSayisi   , pR1[Sistem.BarSayisi -1],  Color.White,"Tahoma", 8  );
              Sistem.YaziEkle("R2", 1, Sistem.BarSayisi   , pR2[Sistem.BarSayisi -1],  Color.White,"Tahoma", 8  );
              Sistem.YaziEkle("R3", 1, Sistem.BarSayisi   , pR3[Sistem.BarSayisi -1],  Color.White,"Tahoma", 8  );
              Sistem.YaziEkle("R4", 1, Sistem.BarSayisi   , pR4[Sistem.BarSayisi -1],  Color.White,"Tahoma", 8  );
              Sistem.YaziEkle("R5", 1, Sistem.BarSayisi   , pR5[Sistem.BarSayisi -1],  Color.White,"Tahoma", 8  );
    
    
              Sistem.YaziEkle("PP", 1, Sistem.BarSayisi   , pPP[Sistem.BarSayisi -1],  Color.Yellow,"Tahoma", 8  );
    
    
    
    
              Sistem.YaziEkle("S1", 1, Sistem.BarSayisi   , pS1[Sistem.BarSayisi -1],  Color.White,"Tahoma", 8  );
              Sistem.YaziEkle("S2", 1, Sistem.BarSayisi   , pS2[Sistem.BarSayisi -1],  Color.White,"Tahoma", 8  );
              Sistem.YaziEkle("S3", 1, Sistem.BarSayisi   , pS3[Sistem.BarSayisi -1],  Color.White,"Tahoma", 8  );
              Sistem.YaziEkle("S4", 1, Sistem.BarSayisi   , pS4[Sistem.BarSayisi -1],  Color.White,"Tahoma", 8  );
              Sistem.YaziEkle("S5", 1, Sistem.BarSayisi   , pS5[Sistem.BarSayisi -1],  Color.White,"Tahoma", 8  );   
    //        ===============================================================================================
    Hocam çok teşekkür ederim.

    Bir de volume profile bulabilirsek iki ekrandan kurtulmuş olacağız.

    mql5 kodunu buraya bırakıyorum. Belki bir hayır sever çıkar

    //+------------------------------------------------------------------+
    //| Volume Profile.mq5 |
    //| Copyright 2022, MetaQuotes Ltd. |
    //| https://www.mql5.com |
    //+------------------------------------------------------------------+
    #property copyright "Mohammad E. Baset"
    #property link "[email protected]"
    #property version "1.00"
    #property indicator_chart_window
    #property indicator_buffers 0
    #property indicator_plots 0
    //--- input parameters
    input ENUM_TIMEFRAMES tf0=PERIOD_CURRENT; // calcualtion timeframe
    input int precision = 100; // number of VP bars
    input ENUM_APPLIED_VOLUME av = VOLUME_REAL; // applied volume
    input double ratio=0.25; // ratio of maximum VP bar length to chart width
    input color gc=clrSlateGray; // bars color
    input color pocc=clrOrange; // POC color
    input color svlc=clrGreen; // start vline color
    input color evlc=clrGreen; // end vline color
    ENUM_TIMEFRAMES tf = tf0;
    //+------------------------------------------------------------------+
    //| Custom indicator initialization function |
    //+------------------------------------------------------------------+
    int OnInit()
    {
    //---number of VP bars couldn't be zero or less than zero
    if(precision<=0)
    {
    Alert("precision couldn't be zero or less than zero");
    return(INIT_FAILED);
    }

    //---if the calculation timeframe is greater than the current timeframe, use the current timeframe
    if(PeriodSeconds(PERIOD_CURRENT)<PeriodSeconds(tf0 ))
    tf=PERIOD_CURRENT;
    ChartRedraw(0);
    //---
    return(INIT_SUCCEEDED);
    }
    //+------------------------------------------------------------------+
    //| |
    //+------------------------------------------------------------------+
    void OnDeinit(const int reason)
    {
    //---Delete vertical lines indicating the beginning and end of the range just when the indicator has been removed
    if(reason==1)
    ObjectsDeleteAll(0,"VP",-1,-1);
    //---otherwise just redraw the chart
    if(reason!=1)
    ChartRedraw();
    }
    //+------------------------------------------------------------------+
    //| |
    //+------------------------------------------------------------------+
    void OnChartEvent(const int id,const long& lparam,const double& dparam,const string& sparam)
    {
    //---Check for vertical lines indicating the beginning and end of the range. If they are not present, draw them.
    if(ObjectFind(0,"VP begin")<0)
    VLineCreate("VP begin",TimeCurrent()-61*PeriodSeconds(PERIOD_CURRENT),svlc);
    if(ObjectFind(0,"VP finish")<0)
    VLineCreate("VP finish",TimeCurrent()-1*PeriodSeconds(PERIOD_CURRENT),evlc);

    //---Do not run the program unless an object has dragged or the chart has changed
    if(id!=CHARTEVENT_OBJECT_DRAG && id!=CHARTEVENT_CHART_CHANGE)
    return;
    if(id==CHARTEVENT_OBJECT_DRAG && (sparam=="VP begin" || sparam=="VP finish"))
    ChartRedraw(0);

    //---Get the datetime data of the begining and end of the range.
    datetime time_begin = (datetime)ObjectGetInteger(0,"VP begin",OBJPROP_TIME);
    datetime time_finish = (datetime)ObjectGetInteger(0,"VP finish",OBJPROP_TIME);

    //---Number of bars in the range based on the calculation timeframe (not the current timeframe visible in the chart).
    int bars = Bars(_Symbol,tf,time_begin,time_finish);
    if(time_begin>=time_finish)
    return;

    //---Copy high-low-volume data of the calculation timeframe.
    double high_array[];
    double low_array[];
    long volume[];
    ArrayResize(high_array,bars);
    ArrayResize(low_array,bars);
    ArrayResize(volume,bars);
    if(CopyHigh(_Symbol,tf,time_begin,time_finish,high _array)==-1 ||
    CopyLow(_Symbol,tf,time_begin,time_finish,low_arra y)==-1 ||
    CopyRealVolume(_Symbol,tf,time_begin,time_finish,v olume)==-1)
    return;
    if(av==VOLUME_TICK || volume[0]==0)
    if(CopyTickVolume(_Symbol,tf,time_begin,time_finis h,volume)==-1)
    return;
    //---Find the max-min price in the range & the height of VP bars based on the number of bars (precision input)
    double max = high_array[ArrayMaximum(high_array,0,WHOLE_ARRAY)]; // highest price in the range
    double min = low_array[ArrayMinimum(low_array,0,WHOLE_ARRAY)]; // lowest price in the range
    double range = (max-min)/precision; // height of the VP bars

    //---Create an array to store the VP data
    double profile[];
    ArrayResize(profile,precision);

    //---Calculate VP array
    //---Loop through all price bars in the range and cumulatively assign their volume to VPs.
    for(int i=0; i<bars && !IsStopped(); i++)
    {
    int Floor = (int)MathFloor((low_array[i]-min)/range); // the first level of VP just below the low of the ith candle
    int Ceil = (int)MathFloor((high_array[i]-min)/range); // the first level ov VP just above the high of the ith candle
    double body = high_array[i]-low_array[i]; // the height of ith candle
    //---When the lower part of the candle falls between two levels of VPs, we have to consider just that part, not the entire level height
    double tail = min+(Floor+1)*range-low_array[i];
    //---When the upper part of the candle falls between two levels of VPs, we have to consider just that part, not the entire level height
    double wick = high_array[i]-(min+(Ceil)*range);
    //---set the values of VPs to zero in the first step of the loop, because we are accumulating volumes to find VPs and they should be zero in the begining
    if(i==0)
    for(int n=0; n<precision; n++)
    profile[n]=0.0;
    for(int n=0; n<precision && !IsStopped(); n++)
    {
    if(n<Floor || n>Ceil) // when no part of the candle is in the nth level of VP, continue
    continue;
    if(Ceil-Floor==0) // when all of the candle is in the nth level of VP, add whole volume of the candle to that level of VP
    profile[n]+=(double)volume[i];
    else
    if(n==Floor) // when the lower part of the candle falls in the nth level of VP, but it doesn't cover the whole height of the nth level
    profile[n]+=(tail/body)*volume[i];
    else
    if(n==Ceil) // when the upper part of the candle falls in the nth level of VP, but it doesn't cover the entire height of the nth level
    profile[n]+=(wick/body)*volume[i];
    else
    profile[n]+=(range/body)*volume[i]; // when a part of the candle covers the entire height of the nth level
    }
    }
    //--- Point of Control is the maximum VP found in the volume profile array
    double POC=profile[ArrayMaximum(profile,0,WHOLE_ARRAY)];
    //---Define the maximum length of VP bars (which is for POC) by considering the width of the chart and ratio input
    int BL=(int)(ratio*ChartGetInteger(0,CHART_WIDTH_IN_PI XELS));
    //---Find an appropriate height for VP bars by considering the chart height and the number of VP bars
    int ch = int(ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS) * ((max-min)/(ChartGetDouble(0,CHART_PRICE_MAX)-ChartGetDouble(0,CHART_PRICE_MIN)))/precision);

    if(POC==0.0)
    return;
    //---delete all existing bars before drawing new ones
    ObjectsDeleteAll(0,"VP prfl ",-1,-1);

    //---Draw VP bars one by one from the lowest price in the range to the highest
    for(int n=0; n<precision; n++)
    {
    //--- The length of each VP bar is calculated by its ratio to POC
    int xd=(int)((profile[n]/POC)*BL);
    int x_start=0;
    int y_start=0;
    //--- Finding the xy position for drawing VPs according to the end vline and min price in the range
    ChartTimePriceToXY(0,0,time_finish,min+(n+1)*range ,x_start,y_start);
    //--- In case the end of VPs go beyond the visible chart
    if(x_start+xd>=ChartGetInteger(0,CHART_WIDTH_IN_PI XELS))
    xd=(int)ChartGetInteger(0,CHART_WIDTH_IN_PIXELS)-x_start;
    //---Draw rectangle lable to display VP bars, using RectLabelCreate function
    RectLabelCreate("VP prfl "+IntegerToString(n),x_start,y_start,xd,ch,gc) ;
    //---Change the color of POC
    if(profile[n]==POC)
    {
    ObjectSetInteger(0,"VP prfl "+IntegerToString(n),OBJPROP_COLOR,pocc);
    ObjectSetInteger(0,"VP prfl "+IntegerToString(n),OBJPROP_BGCOLOR,pocc);
    }
    }
    //---
    ChartRedraw(0);
    }
    //+------------------------------------------------------------------+
    //| 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[])
    {
    //---

    //--- return value of prev_calculated for next call
    return(rates_total);
    }
    //+------------------------------------------------------------------+
    //| Create the vertical line |
    //+------------------------------------------------------------------+
    bool VLineCreate(const string name="VLine", // line name
    datetime time=0, // line time
    const color clr=clrRed, // line color
    const ENUM_LINE_STYLE style=STYLE_DOT, // line style
    const int width=1, // line width
    const long chart_ID=0, // chart's ID
    const int sub_window=0, // subwindow index
    const bool back=true, // in the background
    const bool selection=true, // highlight to move
    const bool ray=true, // line's continuation down
    const bool hidden=false, // hidden in the object list
    const long z_order=0) // priority for mouse click
    {
    //--- if the line time is not set, draw it via the last bar
    if(!time)
    time=TimeCurrent();
    //--- reset the error value
    ResetLastError();
    //--- create a vertical line
    if(!ObjectCreate(chart_ID,name,OBJ_VLINE,sub_windo w,time,0))
    {
    Print(__FUNCTION__,
    ": failed to create a vertical line! Error code = ",GetLastError());
    return(false);
    }
    //--- set line color
    ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
    //--- set line display style
    ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style );
    //--- set line width
    ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width );
    //--- display in the foreground (false) or background (true)
    ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
    //--- enable (true) or disable (false) the mode of moving the line by mouse
    //--- when creating a graphical object using ObjectCreate function, the object cannot be
    //--- highlighted and moved by default. Inside this method, selection parameter
    //--- is true by default making it possible to highlight and move the object
    ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE, selection);
    ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,se lection);
    //--- enable (true) or disable (false) the mode of displaying the line in the chart subwindows
    ObjectSetInteger(chart_ID,name,OBJPROP_RAY,ray);
    //--- hide (true) or display (false) graphical object name in the object list
    ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidd en);
    //--- set the priority for receiving the event of a mouse click in the chart
    ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_or der);
    //--- successful execution
    return(true);
    }
    //+------------------------------------------------------------------+
    //| Create rectangle label |
    //+------------------------------------------------------------------+
    bool RectLabelCreate(const string name="RectLabel", // label name
    const int x=0, // X coordinate
    const int y=0, // Y coordinate
    const int width=50, // width
    const int height=1, // height
    const color clr=clrRed, // flat border color (Flat)
    const color back_clr=clrNONE, // background color
    const ENUM_BORDER_TYPE border=BORDER_FLAT, // border type
    const ENUM_BASE_CORNER corner=CORNER_LEFT_UPPER, // chart corner for anchoring
    const ENUM_LINE_STYLE style=STYLE_SOLID, // flat border style
    const int line_width=1, // flat border width
    const long chart_ID=0, // chart's ID
    const int sub_window=0, // subwindow index
    const bool back=true, // in the background
    const bool selection=false, // highlight to move
    const bool hidden=true, // hidden in the object list
    const long z_order=0) // priority for mouse click
    {
    //--- reset the error value
    ResetLastError();
    //--- create a rectangle label
    if(!ObjectCreate(chart_ID,name,OBJ_RECTANGLE_LABEL ,sub_window,0,0))
    {
    Print(__FUNCTION__,
    ": failed to create a rectangle label! Error code = ",GetLastError());
    return(false);
    }
    //--- set label coordinates
    ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x );
    ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y );
    //--- set label size
    ObjectSetInteger(chart_ID,name,OBJPROP_XSIZE,width );
    ObjectSetInteger(chart_ID,name,OBJPROP_YSIZE,heigh t);
    //--- set background color
    ObjectSetInteger(chart_ID,name,OBJPROP_BGCOLOR,bac k_clr);
    //--- set border type
    ObjectSetInteger(chart_ID,name,OBJPROP_BORDER_TYPE ,border);
    //--- set the chart's corner, relative to which point coordinates are defined
    ObjectSetInteger(chart_ID,name,OBJPROP_CORNER,corn er);
    //--- set flat border color (in Flat mode)
    ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
    //--- set flat border line style
    ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style );
    //--- set flat border width
    ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,line_ width);
    //--- display in the foreground (false) or background (true)
    ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
    //--- enable (true) or disable (false) the mode of moving the label by mouse
    ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE, selection);
    ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,se lection);
    //--- hide (true) or display (false) graphical object name in the object list
    ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidd en);
    //--- set the priority for receiving the event of a mouse click in the chart
    ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_or der);
    //--- successful execution
    return(true);
    }
    //+------------------------------------------------------------------+


    https://www.mql5.com/en/code/47784

  4. Erol hocanın basit kademe robotu.....most al verdiğinde al sat a başlaması için most eklemeye çalıştım robot çalışmadı...nerede yanlış düşünüyorum....most u nasıl eklemem lazım.....


    //Hisse Talimatlari burada girilecek.
    var Sozluk = new Dictionary<string, List<double>>();
    Sozluk["IMKBH'TEKTU"] = new List<double> { 0.02, 0.04, 1, 5, 3 };//Hisse - kademe_al_seviye / kademe_sat_seviye / kademe_lot / yuksek / dusuk
    //Sozluk["CRP'ETHUSDT_BNC"] = new List<double> { 20, 20, 0.01, 6000, 2000 };//Hisse - kademe_al_seviye / kademe_sat_seviye / kademe_lot / yuksek / dusuk
    // Sozluk["CRP'BNBUSDT_BNC"] = new List<double> { 5, 5, 0.1, 600, 200 };//Hisse - kademe_al_seviye / kademe_sat_seviye / kademe_lot / yuksek / dusuk

    //Ana dongu kod yapisi
    for (var No = 0; No < Sozluk.Count; No++)
    {
    var EmirSembol = Sozluk.ElementAt(No).Key;
    var Anahtar = Sistem.Name + " , " + EmirSembol;
    var IslemFiyat = 0.0;
    DateTime IslemTarih;
    var Rezerv = "";
    var AlisFiyat = 0.0m;
    var SatisFiyat = 0.0m;
    var KademeFiyat = 0.0m;
    var Pozisyon = Sistem.PozisyonKontrolOku(Anahtar, out IslemFiyat, out IslemTarih, out Rezerv);
    var Lot = (double)Sozluk.ElementAt(No).Value[2];
    var Yuksek = (double)Sozluk.ElementAt(No).Value[3];
    var Dusuk = (double)Sozluk.ElementAt(No).Value[4];

    var basicitem = Sistem.YuzeyselVeriOku(EmirSembol);
    var sonfiyat = (decimal)basicitem.LastPrice;
    var bidfiyat = (decimal)basicitem.BidPriceDec;
    var askfiyat = (decimal)basicitem.AskPriceDec;



    if (sonfiyat == 0) continue;
    if (bidfiyat == 0) continue;
    if (askfiyat == 0) continue;

    //Ilk İslem Sarti (Mevcut fiyat yuksek/dusuk arasinda ise ve poz yoksa, Al/Sat seviyesi kademe kadar belirlenir)
    string DosyaDir = "C:\\iDeal\\Kademe\" + EmirSembol.Split('\'')[1] + ".YapilanIslemler.txt"; // Dosya Adi
    if (!System.IO.Directory.Exists("C:\\iDeal\\Kademe\") ) System.IO.Directory.CreateDirectory("C:\\iDeal\\Ka deme\");
    if (!System.IO.File.Exists(DosyaDir)) System.IO.File.Create(DosyaDir);
    var ReadLines = System.IO.File.ReadAllLines(DosyaDir);
    if (ReadLines.Count() != 0)
    {
    KademeFiyat = (decimal)Convert.ToSingle(ReadLines.Last().Split(' \t')[1]);
    AlisFiyat = (decimal)Convert.ToSingle(ReadLines.Last().Split(' \t')[2]);
    SatisFiyat = (decimal)Convert.ToSingle(ReadLines.Last().Split(' \t')[3]);
    }
    else
    {
    AlisFiyat = (decimal)askfiyat;
    }

    var Islem = "";
    var Miktar = 0.0;

    ///////////////////////////////////
    var V = Sistem.GrafikVerileriniOku(Sistem.Sembol, "1");
    var C = Sistem.GrafikFiyatSec("Kapanis");
    var MA =Sistem.MA(C, "Exp", 10);
    var TOMA = Sistem.TOMA(10, 0.25, "Exp");

    var SonYon = "";
    for (int i = 1; i < Sistem.BarSayisi; i++)
    {
    if(MA[i-1] < TOMA[i-1] && MA[i] > TOMA[i] && SonYon !="A")
    {
    SonYon = "A";
    Sistem.Yon[i] = "A";
    }
    if(MA[i-1] > TOMA[i-1] && MA[i] < TOMA[i] && SonYon !="F")
    {
    SonYon = "F";
    Sistem.Yon[i] = "F";
    }
    }



    ////////////////////////////////////////////

    if (SonYon=="A" && bidfiyat <= AlisFiyat && Pozisyon >= 0 && bidfiyat >= (decimal)Dusuk && bidfiyat <= (decimal)Yuksek) // AL
    {
    Rezerv = "Alis : " + bidfiyat.ToString("0.00");
    Miktar = Lot;
    IslemFiyat = (double)bidfiyat;

    }
    else if (askfiyat >= SatisFiyat && Pozisyon > 0)
    {
    Rezerv = "Satis: " + askfiyat.ToString("0.00") + " Kar: " + (1 - Sistem.SayiYuvarla((decimal)IslemFiyat / SatisFiyat, 0.0001)).ToString("%0.00");
    Miktar = -Lot;
    IslemFiyat = (double)askfiyat;
    }


    if (Miktar > 0) Islem = "Alis";
    if (Miktar < 0) Islem = "Satis";



    if (Islem != "")
    {
    Sistem.PozisyonKontrolGuncelle(Anahtar, Miktar + Pozisyon, IslemFiyat, Rezerv);
    Sistem.EmirSembol = EmirSembol;
    Sistem.EmirIslem = Islem;
    Sistem.EmirSuresi = "KIE"; //"GUN", "KIE", "IKG" //Kriptolar icin "GTC", Limit icin "GUN" ve "IKG"
    Sistem.EmirTipi = "Piyasa"; //"Limit", "Piyasa"
    Sistem.EmirMiktari = (double)Math.Abs(Miktar);
    Sistem.EmirFiyati = IslemFiyat;
    Sistem.EmirAciklama = Rezerv;
    Sistem.EmirHesapAdi = "225524, Osmanlı Menkul"; //Portfoy peneceresinde gözüken ile aynı Hesap
    Sistem.EmirAltHesap = "225524"; ////Portfoy peneceresinde gözüken ile aynı Alt Hesap
    Sistem.EmirGonder();

    //Alış Islemi Islemler dosyasına eklenir.
    if (Islem == "Alis")
    {
    string Mesaj = EmirSembol + "\t" + IslemFiyat.ToString() + "\t" + ((decimal)IslemFiyat - (decimal)Sozluk.ElementAt(No).Value[0]).ToString() + "\t" + ((decimal)IslemFiyat + (decimal)Sozluk.ElementAt(No).Value[1]).ToString() + "\t" + Lot.ToString() + "\t" + System.DateTime.Now.ToString() + "\r\n";
    System.IO.File.AppendAllText(DosyaDir, Mesaj);
    }
    //Son Islem Islemler dosyasından çıkarılır.
    if (Islem == "Satis")
    {
    var ReadLines2 = System.IO.File.ReadAllLines(DosyaDir);
    System.IO.File.WriteAllLines(DosyaDir, ReadLines2.Take(ReadLines2.Count() - 1));
    }
    }
    }
    İDEAL KOD YAZMADA YENİYİM....SORULARIMDAKİ AMACIM ....İDEALİN MANTIĞINI ANLAYABİLMEK ....YOL GÖSTERMENİZ YETERLİDİR TŞK...

  5. Bu kodda nerde hata yapıyorum.
    //stochFirst:=(c-llv(l,5))/(hhv(h,5)-llv(l,5));
    //smoothingFirst:= mov( stochFirst,3,e)*100;
    //stochSecond:=(smoothingFirst-llv(smoothingFirst,5))/(hhv(smoothingFirst,5)-llv(smoothingFirst,5));
    //smoothingSecond:=mov( stochSecond,3,e)*100;
    //smoothingSecond
    var V = Sistem.GrafikVerileri;
    var C = Sistem.GrafikFiyatSec("Kapanis");
    var H = Sistem.GrafikFiyatSec("Yuksek");
    var L = Sistem.GrafikFiyatSec("Dusuk");
    var hhv = Sistem.HHV(5, H);
    var llv = Sistem.LLV(5, L);
    var stochFirst = Sistem.Liste(0);
    for (int i = 1; i < V.Count; i++)
    {
    stochFirst[i] = ((C[i]-llv[i])/(hhv[i]-llv[i]));
    }
    var mov=Sistem.MA(stochFirst, "Exp", 3);
    //smoothingFirst:= mov( stochFirst,3,e)*100;

    var smoothingFirst = Sistem.Liste(0);
    for (int i = 1; i < V.Count; i++)
    {
    smoothingFirst[i] = mov[i]*100;
    }

    var llvsm=Sistem.LLV(5,smoothingFirst);

    var hhvsm=Sistem.HHV(5, smoothingFirst);
    //stochSecond:=(smoothingFirst-llv(smoothingFirst,5))/(hhv(smoothingFirst,5)-llv(smoothingFirst,5));

    var stochSecond = Sistem.Liste(0);
    for (int i = 1; i < V.Count; i++)
    {
    stochSecond[i] = ((smoothingFirst[i]-llvsm[i])/(hhvsm[i]-llvsm[i]));
    }
    //smoothingSecond:=mov( stochSecond,3,e)*100;
    var movd=Sistem.MA(stochSecond, "Exp", 3);
    var smoothingSecond = Sistem.Liste(0);
    for (int i = 1; i < V.Count; i++)
    {
    smoothingSecond[i] = movd[i]*100;
    }
    Sistem.Cizgiler[0].Deger = smoothingSecond;

  6. Buralarda;
    stochFirst[i] = (hhv[i] - llv[i]) == 0 ? 0 : ((C[i] - llv[i]) / (hhv[i] - llv[i]));
    stochSecond[i] = (hhvsm[i] - llvsm[i]) == 0 ? 0 : ((smoothingFirst[i] - llvsm[i]) / (hhvsm[i] - llvsm[i]));

  7.  Alıntı Originally Posted by bymehmet Yazıyı Oku
    Buralarda;
    stochFirst[i] = (hhv[i] - llv[i]) == 0 ? 0 : ((C[i] - llv[i]) / (hhv[i] - llv[i]));
    stochSecond[i] = (hhvsm[i] - llvsm[i]) == 0 ? 0 : ((smoothingFirst[i] - llvsm[i]) / (hhvsm[i] - llvsm[i]));
    teşekkür ederim.

  8. nerede yanlış düşünüyorum ....
    //Hisse Talimatlari burada girilecek.
    var Sozluk = new Dictionary<string, List<double>>();
    Sozluk["IMKBH'KOZAL"] = new List<double> { 0.04, 0.08, 1, 30, 20 };//Hisse - kademe_al_seviye / kademe_sat_seviye / kademe_lot / yuksek / dusuk
    //Sozluk["IMKBH'HALKB"] = new List<double> { 0.02, 0.07, 20, 16.80, 13 };//Hisse - kademe_al_seviye / kademe_sat_seviye / kademe_lot / yuksek / dusuk
    //Sozluk["IMKBH'TSKB"] = new List<double> { 0.02, 0.07, 10, 10, 7 };//Hisse - kademe_al_seviye / kademe_sat_seviye / kademe_lot / yuksek / dusuk

    //Ana dongu kod yapisi
    for (var No = 0; No < Sozluk.Count; No++)
    {
    var EmirSembol = Sozluk.ElementAt(No).Key;
    var Anahtar = Sistem.Name + " , " + EmirSembol;
    var IslemFiyat = 0.0;
    DateTime IslemTarih;
    var Rezerv = "";
    var AlisFiyat = 0.0m;
    var SatisFiyat = 0.0m;
    var KademeFiyat = 0.0m;
    var Pozisyon = Sistem.PozisyonKontrolOku(Anahtar, out IslemFiyat, out IslemTarih, out Rezerv);
    var Lot = (double)Sozluk.ElementAt(No).Value[2];
    var Yuksek = (double)Sozluk.ElementAt(No).Value[3];
    var Dusuk = (double)Sozluk.ElementAt(No).Value[4];

    var basicitem = Sistem.YuzeyselVeriOku(EmirSembol);
    var sonfiyat = (decimal)basicitem.LastPrice;
    var bidfiyat = (decimal)basicitem.BidPriceDec;
    var askfiyat = (decimal)basicitem.AskPriceDec;

    if (sonfiyat == 0) continue;
    if (bidfiyat == 0) continue;
    if (askfiyat == 0) continue;

    //Ilk İslem Sarti (Mevcut fiyat yuksek/dusuk arasinda ise ve poz yoksa, Al/Sat seviyesi kademe kadar belirlenir)
    string DosyaDir = "C:\\iDeal\\Kademeler" + EmirSembol.Split('\'')[1] + ".YapilanIslemler.txt"; // Dosya Adi
    if (!System.IO.Directory.Exists("C:\\iDeal\\Kademeler ")) System.IO.Directory.CreateDirectory("C:\\iDeal\\Ka demeler");
    if (!System.IO.File.Exists(DosyaDir)) System.IO.File.Create(DosyaDir);
    var ReadLines = System.IO.File.ReadAllLines(DosyaDir);
    if (ReadLines.Count() != 0)
    {
    KademeFiyat = (decimal)Convert.ToSingle(ReadLines.Last().Split(' \t')[1]);
    AlisFiyat = (decimal)Convert.ToSingle(ReadLines.Last().Split(' \t')[2]);
    SatisFiyat = (decimal)Convert.ToSingle(ReadLines.Last().Split(' \t')[3]);
    }
    else
    {
    AlisFiyat = (decimal)askfiyat;
    }



    var Islem = "";
    var Miktar = 0.0;
    //EKLEDİĞİM YER BURASI.....
    var V = Sistem.GrafikVerileriniOku(Sistem.Sembol, "G");
    // var V = Sistem.GrafikFiyatOku(Sembol, "G", "Kapanis");
    var TTI = Sistem.TOMA(V, 3, 1, "Variable");
    var MA = Sistem.MA(V, "Variable", 3);
    var START = MA[MA.Count - 1] > TOMA[TOMA.Count - 2];
    if (START) //BU KOŞUL SAĞLANIRSA ALIŞ YAP
    {




    if (bidfiyat <= AlisFiyat && Pozisyon >= 0 && bidfiyat >= (decimal)Dusuk && bidfiyat <= (decimal)Yuksek) // AL
    {
    Rezerv = "Alis : " + bidfiyat.ToString("0.00");
    Miktar = Lot;
    IslemFiyat = (double)bidfiyat;
    }
    }


    else if (askfiyat >= SatisFiyat && Pozisyon > 0)
    {
    Rezerv = "Satis: " + askfiyat.ToString("0.00") + " Kar: " + (1 - Sistem.SayiYuvarla((decimal)IslemFiyat / SatisFiyat, 0.0001)).ToString("%0.00");
    Miktar = -Lot;
    IslemFiyat = (double)askfiyat;
    }

    if (Miktar > 0) Islem = "Alis";
    if (Miktar < 0) Islem = "Satis";
    if (Islem != "")
    {
    Sistem.PozisyonKontrolGuncelle(Anahtar, Miktar + Pozisyon, IslemFiyat, Rezerv);
    Sistem.EmirSembol = EmirSembol;
    Sistem.EmirIslem = Islem;
    Sistem.EmirSuresi = "KIE"; //"GUN", "KIE", "IKG" //Kriptolar icin "GTC", Limit icin "GUN" ve "IKG"
    Sistem.EmirTipi = "Piyasa"; //"Limit", "Piyasa"
    Sistem.EmirMiktari = (double)Math.Abs(Miktar);
    Sistem.EmirFiyati = IslemFiyat;
    Sistem.EmirAciklama = Rezerv;
    Sistem.EmirHesapAdi = "255516, Osmanlı Menkul"; //Portfoy peneceresinde gözüken ile aynı Hesap
    Sistem.EmirAltHesap = "255516"; ////Portfoy peneceresinde gözüken ile aynı Alt Hesap
    Sistem.EmirGonder();

    //Alış Islemi Islemler dosyasına eklenir.
    if (Islem == "Alis")
    {
    string Mesaj = EmirSembol + "\t" + IslemFiyat.ToString() + "\t" + ((decimal)IslemFiyat - (decimal)Sozluk.ElementAt(No).Value[0]).ToString() + "\t" + ((decimal)IslemFiyat + (decimal)Sozluk.ElementAt(No).Value[1]).ToString() + "\t" + Lot.ToString() + "\t" + System.DateTime.Now.ToString() + "\r\n";
    System.IO.File.AppendAllText(DosyaDir, Mesaj);
    }
    //Son Islem Islemler dosyasından çıkarılır.
    if (Islem == "Satis")
    {
    var ReadLines2 = System.IO.File.ReadAllLines(DosyaDir);
    System.IO.File.WriteAllLines(DosyaDir, ReadLines2.Take(ReadLines2.Count() - 1));
    }
    }
    }
    İDEAL KOD YAZMADA YENİYİM....SORULARIMDAKİ AMACIM ....İDEALİN MANTIĞINI ANLAYABİLMEK ....YOL GÖSTERMENİZ YETERLİDİR TŞK...

Sayfa 589/593 İlkİlk ... 89489539579587588589590591 ... SonSon

Yer İmleri

Yer İmleri

Gönderi Kuralları

  • Yeni konu açamazsınız
  • Konulara cevap yazamazsınız
  • Yazılara ek gönderemezsiniz
  • Yazılarınızı değiştiremezsiniz
  •