Jump to content

udc

Members
  • Posts

    224
  • Joined

  • Last visited

  • Days Won

    24

Posts posted by udc

  1. Just came to my mind maybe another way could be to trade in the middle of the levels. Like in the above example with one level at 50 and other at 100 to open a buy stop at 80 with SL at 70 and TP at 95. And of course similarly a sell stop at 70 with SL at 80 and TP at 55. Does that make sense? Another question is whether always aim all the way up close to the next level or only a predefined shorter segment. Or maybe a shorter, half position close and the rest with the trailing stop? Many questions..
  2. Hi and thank you for your reply.

     

    So stop orders on both sides in x distance from the level, with SL at y distance and TP at z distance. Those 3 variables could be optimized against the past data. Now the question is whether any of those variables should be derived from the actual market situation at the time when the level is reached, like the spread, maybe ATR etc. In that case instead placing stop orders in advance the market orders placed in the real time would have to be used. That could also be determined by simulation using the past ticks data.

     

    Anyway what I see as a major advantage of trading around these levels (although I may be totally wrong here) is that SL can be relatively tight. For example, if the level is at 50, and the next level is above 100, then I would see as reasonable a buy stop at 60 with SL at 45 (to allow a short backshoot) and TP at 80.

     

    Well, so this is one way. Now you are saying there are other ways, I would be interested in hearing about what they may be. Could you outline it a bit?

  3. Hi everyone,

     

    let's say that, hypothetically, you have information about various price levels where the resting orders are accumulated. Not just some random resting orders, but orders that actually move the price. It doesn't matter what type of orders, what's important is that once the price gets to such a level it either bounces back (to the previous level) or shoots through it (towards the next level). Now if you think about it, all what the price is actually doing, all those cycles and cycles-within-cycles, that's all merely just the price traveling from one level to another (with scalpers and news traders and similar short-term anomalies along the way).

     

    Imagine you have access into all computers of given market, then this is basically the only information you would be able to find out - information about the resting orders (where they are placed at and in what amount). Beside that there is no other secret to find out.

     

    Now I am a programmer, not a trader, so maybe it's just my ignorance or a lack of imagination, but how could you possibly use such information in order to take advantage of it? You still wouldn't know in advance whether the price will actually bounce or penetrate once it reaches the level because you can't know how strong the trend will be at that time (i.e. whether the participants already in play will "overpower" the resting orders, or will get overpowered by them).

     

    So how could you make use of such knowledge? All I can think of is to wait till the price reaches the level and then set stop orders in both directions, that way both possible outcomes would be covered. Is that all what could be done?

  4. Ocn_FastNMAvsNMA_MTF

     

    Those who are interested in FastNMAvsNMA crossovers on multiple timeframes may find useful the multi-timeframe version: "Ocn_FastNMAvsNMA_MTF". This allows you to stack up several FastNMAvsNMA indicators each showing data from a different timeframe and this all in a single chart window.

     

    To specify of which timeframe you want to display FastNMAvsNMA, simply set the "TF" variable. You can choose any timeframe you want (values 1, 5, 15, 30, 60, 240, 1440, 10080 and 43200), if there is enough data available it will be calculated and displayed no matter what timeframe is the current chart. If you want to use chart's timeframe you can either set TF appropriately or leave it at 0 (default value).

     

    The following screenshot shows M5 chart with FastNMAvsNMA from M1 (yellow), M5 (orange) and M15 (red).

    http://img842.imageshack.us/img842/2306/ocnfastnmavsnmamtf2.png

     

    Another example shows M15 chart with FastNMAvsNMA from M1 (white), M5 (yellow), M15 (orange), M30 (red) and H1 (purple).

    http://img338.imageshack.us/img338/2016/ocnfastnmavsnmamtf.png

     

    And of course you can use the multi-timeframe SD bands as well:

    http://img27.imageshack.us/img27/4687/ocnfastnmavsnmamtfsd.png

     

     

    // Ocn_FastNMAvsNMA_MTF version 1.10
    #property  copyright "NMA algorithm © jim sloman, for metatrader programmed by udc"
    #property  link      "[email protected]"
    
    #property indicator_separate_window
    #property indicator_buffers 4
    #property indicator_color1 Magenta
    #property indicator_color2 Silver
    #property indicator_color3 Silver
    #property indicator_color4 Silver
    #property indicator_level1 0
    #property indicator_levelcolor Gray
    #property indicator_levelstyle 2
    
    extern int    TF                 = 0;
    extern int    NMA_period         = 40;
    extern int    FastNMA_period     = 40;
    extern int    FastNMA_LB_min     = 8;
    extern bool   Show_SD            = false;
    extern int    SD_len             = 30;
    extern double SD_up              = 2;
    extern double SD_dn              = 2;
    extern bool   Show_SD_1line_only = false;
    extern bool   Show_SD_3lines_up  = true;
    extern bool   Show_SD_3lines_dn  = true;
    extern bool   Show_SD_3lines_md  = true;
    extern bool   ValuesInPips       = false;
    extern int    MaxBars            = 0;
    
    double FastNMAvsNMA[];
    double SD[];
    double SD2[];
    double SD3[];
    
    int    NMAmtfbars;
    double NMAmtf[][3];
    double FastNMAvsNMAmtf[];
    double point;
    
    int init()
    {
     string tf = "";
          if(TF == PERIOD_M1)  tf = "_M1";
     else if(TF == PERIOD_M5)  tf = "_M5";
     else if(TF == PERIOD_M15) tf = "_M15";
     else if(TF == PERIOD_M30) tf = "_M30";
     else if(TF == PERIOD_H1)  tf = "_H1";
     else if(TF == PERIOD_H4)  tf = "_H4";
     else if(TF == PERIOD_D1)  tf = "_D1";
     else if(TF == PERIOD_W1)  tf = "_W1";
     else if(TF == PERIOD_MN1) tf = "_MN1";
     else TF = Period();
     string indiname = "FastNMAvsNMA" + tf;
     string name = indiname + "(" + NMA_period + ", " + FastNMA_period + ", " + FastNMA_LB_min + ")";
     IndicatorShortName(name);
     IndicatorBuffers(4);
     SetIndexBuffer(0, FastNMAvsNMA);
     SetIndexLabel(0, name);
     SetIndexBuffer(1, SD);
     SetIndexBuffer(2, SD2);
     SetIndexBuffer(3, SD3);
     if(Show_SD_1line_only)
       {
       SetIndexLabel(1, indiname + "_SD(" + SD_len + ")");
       SetIndexLabel(2, "unused");
       SetIndexLabel(3, "unused");
       }
     else
       {
       if(Show_SD_3lines_up) SetIndexLabel(1, indiname + "_SD_up(" + SD_len + ")");
       else                  SetIndexLabel(1, "unused");
       if(Show_SD_3lines_dn) SetIndexLabel(2, indiname + "_SD_dn(" + SD_len + ")");
       else                  SetIndexLabel(2, "unused");
       if(Show_SD_3lines_md) SetIndexLabel(3, indiname + "_SD_md(" + SD_len + ")");
       else                  SetIndexLabel(3, "unused");
       }
     point = Point;
     if(MarketInfo("EURUSD", MODE_POINT) == 0.00001) point *= 10;
    
     int bars = Bars;
     if( (MaxBars > 0) && (MaxBars < bars) ) bars = MaxBars;
     NMAmtfbars = MathMin(bars * Period() / TF, iBars(NULL, TF));
     ArrayResize(NMAmtf, NMAmtfbars); ArrayInitialize(NMAmtf, 0);
     ArrayResize(FastNMAvsNMAmtf, NMAmtfbars); ArrayInitialize(FastNMAvsNMAmtf, 0); ArraySetAsSeries(FastNMAvsNMAmtf, true);
     return(0);
    }
    
    int start()
    {
     int limit, i, ii, counted_bars = IndicatorCounted()-1, bars = Bars, nearestbar;
     double nmasum, nmaabssum, nmaratio, nmmnum, maxnmm, fastnmasum, fastnmaabssum, fastnmaratio, temp;
     bool nmadone, fastnmadone;
    
     if( (MaxBars > 0) && (MaxBars < bars) ) bars = MaxBars;
     if(counted_bars <= 1) limit = bars - 1;
     else                  limit = bars - counted_bars;
     if(limit < 1)         limit = 1;
    
     NMAmtfcalc();
    
     for(i = limit; i >= 0; i--)
       {
       nearestbar = iBarShift(NULL, TF, Time[i]);
       if(nearestbar < iBars(NULL, TF) - MathMax(NMA_period, FastNMA_period))
         {
         FastNMAvsNMA[i] = FastNMAvsNMAmtf[nearestbar];
         if( (Show_SD) && (nearestbar < iBars(NULL, TF) - MathMax(NMA_period, FastNMA_period) - SD_len) )
           {
           if(Show_SD_1line_only)
             {
             if(FastNMAvsNMAmtf[nearestbar] == 0)     SD[i] = 0;
             else if(FastNMAvsNMAmtf[nearestbar] > 0) SD[i] = iBandsOnArray(FastNMAvsNMAmtf, 0, SD_len, SD_up, 0, MODE_UPPER, nearestbar);
             else if(FastNMAvsNMAmtf[nearestbar] < 0) SD[i] = iBandsOnArray(FastNMAvsNMAmtf, 0, SD_len, SD_dn, 0, MODE_LOWER, nearestbar);
             }
           else
             {
             if(Show_SD_3lines_up)  SD[i] = iBandsOnArray(FastNMAvsNMAmtf, 0, SD_len, SD_up, 0, MODE_UPPER, nearestbar);
             if(Show_SD_3lines_dn) SD2[i] = iBandsOnArray(FastNMAvsNMAmtf, 0, SD_len, SD_dn, 0, MODE_LOWER, nearestbar);
             if(Show_SD_3lines_md) SD3[i] = (iBandsOnArray(FastNMAvsNMAmtf, 0, SD_len, SD_up, 0, MODE_UPPER, nearestbar)+
                                             iBandsOnArray(FastNMAvsNMAmtf, 0, SD_len, SD_dn, 0, MODE_LOWER, nearestbar) ) / 2;
             }
           }
         }
       }
    
     return(0);
    }
    
    void NMAmtfcalc()
    {
     int i, ii, iii, NMAoldestbar = NMAmtfbars-1 - MathMax(NMA_period, FastNMA_period);
     bool found;
    
     for(i = NMAoldestbar; i >= 2; i--)
       if(NMAmtf[i][0] != iTime(NULL, TF, i))
         {
         if(i == NMAoldestbar)
           {
           found = false; ii = 1;
           while( !(found) && (i-ii >= 0) )
             if(NMAmtf[i-ii][0] == iTime(NULL, TF, i)) found = true;
             else ii++;
           if(found)
             {
             for(iii = i; iii >= 0; iii--)
               if(iii-ii >= 0)
                 {
                 NMAmtf[iii][0] = NMAmtf[iii-ii][0];
                 NMAmtf[iii][1] = NMAmtf[iii-ii][1];
                 NMAmtf[iii][2] = NMAmtf[iii-ii][2];
                 FastNMAvsNMAmtf[iii] = FastNMAvsNMAmtf[iii-ii];
                 }
               else
                 {
                 NMAmtf[iii][0] = 0;
                 NMAmtf[iii][1] = 0;
                 NMAmtf[iii][2] = 0;
                 FastNMAvsNMAmtf[iii] = 0;
                 }
             }
           else
             {
             NMAmtf[i+1][1] = iClose(NULL, TF, i+1);
             NMAmtf[i+1][2] = iClose(NULL, TF, i+1);
             NMAmtf[i][0] = iTime(NULL, TF, i); NMAcalc(i);
             }
           }
         else
           {
           NMAmtf[i][0] = iTime(NULL, TF, i); NMAcalc(i);
           }
         }
    
     NMAmtf[1][0] = iTime(NULL, TF, 1); NMAcalc(1);
     NMAmtf[0][0] = iTime(NULL, TF, 0); NMAcalc(0);
    }
    
    void NMAcalc(int i)
    {
     int ii;
     double nmasum, nmaabssum, nmaratio, nmmnum, maxnmm, fastnmasum, fastnmaabssum, fastnmaratio, temp;
     bool nmadone, fastnmadone;
    
     nmaratio = 0; maxnmm = 0; fastnmaratio = 0;
     int NMA_LB_max;
     for(ii = 1; ii <= FastNMA_period; ii++)
       {
       nmmnum = (MathLog(iClose(NULL, TF, i)) - MathLog(iClose(NULL, TF, i+ii))) / MathSqrt(ii);
       if(MathAbs(nmmnum) > maxnmm) { maxnmm = MathAbs(nmmnum); NMA_LB_max = ii; }
       }
     if(NMA_LB_max < FastNMA_LB_min) NMA_LB_max = FastNMA_LB_min;
     nmasum = (MathLog(iClose(NULL, TF, i)) - MathLog(iClose(NULL, TF, i+1))) + (MathLog(iClose(NULL, TF, i+1)) - MathLog(iClose(NULL, TF, i+2))) * (MathSqrt(2)-1);
     fastnmasum = nmasum;
     nmadone = false; fastnmadone = false; ii = 2;
     while( !(nmadone) || !(fastnmadone) )
       {
       temp = (MathLog(iClose(NULL, TF, i+ii)) - MathLog(iClose(NULL, TF, i+ii+1))) * (MathSqrt(ii+1) - MathSqrt(ii));
       if(ii >= NMA_period) nmadone=true;
       else                 nmasum += temp;
       if(ii >= NMA_LB_max) fastnmadone=true;
       else                 fastnmasum += temp;
       ii++;
       }
     nmaabssum = MathAbs(nmasum);
     fastnmaabssum = MathAbs(fastnmasum);
     nmasum = 0; fastnmasum = 0;
     nmadone = false; fastnmadone = false; ii = 0;
     while( !(nmadone) || !(fastnmadone) )
       {
       temp = MathAbs(MathLog(iClose(NULL, TF, i+ii)) - MathLog(iClose(NULL, TF, i+ii+1)));
       if(ii >= NMA_period) nmadone=true;
       else                 nmasum += temp;
       if(ii >= NMA_LB_max) fastnmadone=true;
       else                 fastnmasum += temp;
       ii++;
       }
     if(nmasum != 0) nmaratio = nmaabssum / nmasum;
     if(fastnmasum != 0) fastnmaratio = fastnmaabssum / fastnmasum;
     NMAmtf[i][1] = NMAmtf[i+1][1] + (iClose(NULL, TF, i) - NMAmtf[i+1][1]) * nmaratio;
     NMAmtf[i][2] = NMAmtf[i+1][2] + (iClose(NULL, TF, i) - NMAmtf[i+1][2]) * fastnmaratio;
     FastNMAvsNMAmtf[i] = NMAmtf[i][2] - NMAmtf[i][1]; if(ValuesInPips) FastNMAvsNMAmtf[i] = FastNMAvsNMAmtf[i] / point;
    }
    

     

    Source code:

    http://pastebin.com/cyTPMeih

     

     

    P.S.: when stacking indicators onto each other don't forget to manually set the same fixed minimum and maximum to make sure all indicators align.

  5. Ocn_FastNMAvsNMA_NMS

     

    Now those who would prefer seeing FastNMA's slope towards NMA, regardless of its position, may find useful a version of Ocn_FastNMAvsNMA with NMS (natural market slope) internally applied onto it: Ocn_FastNMAvsNMA_NMS. The screenshot should hint its function:

     

    http://img525.imageshack.us/img525/668/ocnfastnmavsnmanms.png

     

    // Ocn_FastNMAvsNMA_NMS version 1.00
    #property  copyright "NMA & NMS algorithms © jim sloman, for metatrader programmed by udc"
    #property  link      "[email protected]"
    
    #property indicator_separate_window
    #property indicator_buffers 5
    #property indicator_color1 Magenta
    #property indicator_color2 Lime
    #property indicator_color3 Silver
    #property indicator_color4 Silver
    #property indicator_color5 Silver
    #property indicator_level1 0
    #property indicator_levelcolor Gray
    #property indicator_levelstyle 2
    
    extern int    NMA_period           = 40;
    extern int    FastNMA_period       = 40;
    extern int    FastNMA_LB_min       = 8;
    extern int    NMS_period           = 40;
    extern bool   Show_ZH              = true;
    extern double ZH_displacement      = 0;
    extern int    ZH_symbol            = 119;
    extern bool   HistogramInsteadLine = false;
    extern bool   Show_SD              = false;
    extern int    SD_len               = 30;
    extern double SD_up                = 2;
    extern double SD_dn                = 2;
    extern bool   Show_SD_1line_only   = false;
    extern bool   Show_SD_3lines_up    = true;
    extern bool   Show_SD_3lines_dn    = true;
    extern bool   Show_SD_3lines_md    = true;
    extern bool   Zero_SD_3lines_when_ZH = false;
    
    double FastNMAvsNMA_NMS[];
    double ZH[];
    double SD[];
    double SD2[];
    double SD3[];
    double NMA[];
    double FastNMA[];
    double FastNMAvsNMA[];
    
    int init()
    {
     string name = "FastNMAvsNMA_NMS(" + NMA_period + ", " + FastNMA_period + ", " + FastNMA_LB_min + ", " + NMS_period + ")";
     IndicatorShortName(name);
     IndicatorBuffers(8);
     SetIndexBuffer(0, FastNMAvsNMA_NMS);
     SetIndexLabel(0, name);
     if(HistogramInsteadLine) SetIndexStyle(0, DRAW_HISTOGRAM);
     else                     SetIndexStyle(0, DRAW_LINE);
     SetIndexBuffer(1, ZH);
     SetIndexLabel(1, "FastNMAvsNMA_NMS_ZH");
     SetIndexStyle(1, DRAW_ARROW);
     SetIndexArrow(1, ZH_symbol);
     SetIndexBuffer(2, SD);
     SetIndexBuffer(3, SD2);
     SetIndexBuffer(4, SD3);
     if(Show_SD_1line_only)
       {
       SetIndexLabel(2, "FastNMAvsNMA_NMS_SD(" + SD_len + ")");
       SetIndexLabel(3, "unused");
       SetIndexLabel(4, "unused");
       }
     else
       {
       if(Show_SD_3lines_up) SetIndexLabel(2, "FastNMAvsNMA_NMS_SD_up(" + SD_len + ")");
       else                  SetIndexLabel(2, "unused");
       if(Show_SD_3lines_dn) SetIndexLabel(3, "FastNMAvsNMA_NMS_SD_dn(" + SD_len + ")");
       else                  SetIndexLabel(3, "unused");
       if(Show_SD_3lines_md) SetIndexLabel(4, "FastNMAvsNMA_NMS_SD_md(" + SD_len + ")");
       else                  SetIndexLabel(4, "unused");
       }
     SetIndexBuffer(5, NMA);
     SetIndexBuffer(6, FastNMA);
     SetIndexBuffer(7, FastNMAvsNMA);
     return(0);
    }
    
    int start()
    {
     int limit, i, ii, counted_bars = IndicatorCounted()-1;
     int max = MathMax(NMA_period, FastNMA_period);
     double nmasum, nmaabssum, nmaratio, nmmnum, maxnmm, fastnmasum, fastnmaabssum, fastnmaratio, temp, nms2;
     bool nmadone, fastnmadone;
    
     if(Bars <= max+NMS_period) return(0);
     if(counted_bars < 0) counted_bars = 0;
     if(counted_bars > max) limit = Bars - counted_bars;
     else                   limit = Bars - max - 1;
    
     for(i = limit; i >= 0; i--)
       {
       if(i == Bars - max - 1) { NMA[i+1] = Close[i+1]; FastNMA[i+1] = Close[i+1]; }
       nmaratio = 0; maxnmm = 0; fastnmaratio = 0;
       int NMA_LB_max;
       for(ii = 1; ii <= FastNMA_period; ii++)
         {
         nmmnum = (MathLog(Close[i]) - MathLog(Close[i+ii])) / MathSqrt(ii);
         if(MathAbs(nmmnum) > maxnmm) { maxnmm = MathAbs(nmmnum); NMA_LB_max = ii; }
         }
       if(NMA_LB_max < FastNMA_LB_min) NMA_LB_max = FastNMA_LB_min;
       nmasum = (MathLog(Close[i]) - MathLog(Close[i+1])) + (MathLog(Close[i+1]) - MathLog(Close[i+2])) * (MathSqrt(2)-1);
       fastnmasum = nmasum;
       nmadone = false; fastnmadone = false; ii = 2;
       while( !(nmadone) || !(fastnmadone) )
         {
         temp = (MathLog(Close[i+ii]) - MathLog(Close[i+ii+1])) * (MathSqrt(ii+1) - MathSqrt(ii));
         if(ii >= NMA_period) nmadone=true;
         else                 nmasum += temp;
         if(ii >= NMA_LB_max) fastnmadone=true;
         else                 fastnmasum += temp;
         ii++;
         }
       nmaabssum = MathAbs(nmasum);
       fastnmaabssum = MathAbs(fastnmasum);
       nmasum = 0; fastnmasum = 0;
       nmadone = false; fastnmadone = false; ii = 0;
       while( !(nmadone) || !(fastnmadone) )
         {
         temp = MathAbs(MathLog(Close[i+ii]) - MathLog(Close[i+ii+1]));
         if(ii >= NMA_period) nmadone=true;
         else                 nmasum += temp;
         if(ii >= NMA_LB_max) fastnmadone=true;
         else                 fastnmasum += temp;
         ii++;
         }
       if(nmasum != 0) nmaratio = nmaabssum / nmasum;
       if(fastnmasum != 0) fastnmaratio = fastnmaabssum / fastnmasum;
       NMA[i] = NMA[i+1] + (Close[i] - NMA[i+1]) * nmaratio;
       FastNMA[i] = FastNMA[i+1] + (Close[i] - FastNMA[i+1]) * fastnmaratio;
       FastNMAvsNMA[i] = FastNMA[i] - NMA[i];
       }
    
     for(i = limit; i >= 0; i--)
       if(i < Bars - max - 1 - NMS_period)
         {
         nms2 = 0;
         for(ii = 1; ii <= NMS_period; ii++)
           {
           double oLRSlope = 0, SumXY = 0, SumY = 0, SumX, SumXSqr, Divisor;
           if(ii > 1)
             {
             SumX = ii * (ii - 1) * 0.5;
             SumXSqr = ii * (ii - 1) * (2 * ii - 1) * 1/6;
             Divisor = (SumX * SumX) - ii * SumXSqr;
             for(int iii = 0; iii < ii; iii++)
               {
               SumXY += iii * FastNMAvsNMA[i+iii];
               SumY += FastNMAvsNMA[i+iii];
               }
             oLRSlope = (ii * SumXY - SumX * SumY) / Divisor;
             }
           nms2 += oLRSlope * MathSqrt(ii);
           }
         FastNMAvsNMA_NMS[i] = nms2 * 100;
         if(Show_ZH) { if(FastNMAvsNMA_NMS[i] == 0) ZH[i] = ZH_displacement; else ZH[i] = EMPTY_VALUE; }
         }
    
     if(Show_SD)
       for(i = limit; i >= 0; i--)
         if(i < Bars - max - 1 - NMS_period - SD_len)
           {
           if(Show_SD_1line_only)
             {
             if(FastNMAvsNMA_NMS[i] == 0)     SD[i] = 0;
             else if(FastNMAvsNMA_NMS[i] > 0) SD[i] = iBandsOnArray(FastNMAvsNMA_NMS, 0, SD_len, SD_up, 0, MODE_UPPER, i);
             else if(FastNMAvsNMA_NMS[i] < 0) SD[i] = iBandsOnArray(FastNMAvsNMA_NMS, 0, SD_len, SD_dn, 0, MODE_LOWER, i);
             }
           else
             {
             if((Zero_SD_3lines_when_ZH) && (FastNMAvsNMA_NMS[i] == 0))
               {
               if(Show_SD_3lines_up) SD[i] = 0;
               if(Show_SD_3lines_dn) SD2[i] = 0;
               if(Show_SD_3lines_md) SD3[i] = 0;
               }
             else
               {
               if(Show_SD_3lines_up) SD[i] = iBandsOnArray(FastNMAvsNMA_NMS, 0, SD_len, SD_up, 0, MODE_UPPER, i);
               if(Show_SD_3lines_dn) SD2[i] = iBandsOnArray(FastNMAvsNMA_NMS, 0, SD_len, SD_dn, 0, MODE_LOWER, i);
               if(Show_SD_3lines_md) SD3[i] = (iBandsOnArray(FastNMAvsNMA_NMS, 0, SD_len, SD_up, 0, MODE_UPPER, i)+
                                               iBandsOnArray(FastNMAvsNMA_NMS, 0, SD_len, SD_dn, 0, MODE_LOWER, i) ) / 2;
               }
             }
           }
    
     return(0);
    }
    

     

    Source code:

    http://pastebin.com/KQNRSwY2

     

     

    Also a version 1.01 of Ocn_FastNMAvsNMA with a new switch "ValuesInPips" added (turned on in the picture above):

    http://pastebin.com/gZJMNn2W

  6. Ocn_FastNMAvsNMA

     

    This is a little indi I wanted to make for a while. All what it does is showing a relative position of FastNMA compared to NMA.

     

    It may be useful for those who want to quickly see whether FastNMA is above or below NMA but for some reason don't want to have them in their main chart. For the lack of a better name I named it "FastNMAvsNMA". For BB maniacs I added the SD bands with typical features as previously seen on TV, you know, all the jazz.

     

    The following picture shows NMA and FastNMA (Ocn_NMAx indi, that is) in the main chart and 3x Ocn_FastNMAvsNMA indi with various settings.

     

    http://img819.imageshack.us/img819/3299/ocnfastnmavsnma.png

     

    // Ocn_FastNMAvsNMA version 1.00
    #property  copyright "NMA algorithm © jim sloman, for metatrader programmed by udc"
    #property  link      "[email protected]"
    
    #property indicator_separate_window
    #property indicator_buffers 4
    #property indicator_color1 Magenta
    #property indicator_color2 Silver
    #property indicator_color3 Silver
    #property indicator_color4 Silver
    #property indicator_level1 0
    #property indicator_levelcolor Gray
    #property indicator_levelstyle 2
    
    extern int    NMA_period         = 40;
    extern int    FastNMA_period     = 40;
    extern int    FastNMA_LB_min     = 8;
    extern bool   Show_SD            = false;
    extern int    SD_len             = 30;
    extern double SD_up              = 2;
    extern double SD_dn              = 2;
    extern bool   Show_SD_1line_only = false;
    extern bool   Show_SD_3lines_up  = true;
    extern bool   Show_SD_3lines_dn  = true;
    extern bool   Show_SD_3lines_md  = true;
    
    double FastNMAvsNMA[];
    double SD[];
    double SD2[];
    double SD3[];
    double NMA[];
    double FastNMA[];
    
    int init()
    {
     string name = "FastNMAvsNMA(" + NMA_period + ", " + FastNMA_period + ", " + FastNMA_LB_min + ")";
     IndicatorShortName(name);
     IndicatorBuffers(6);
     SetIndexBuffer(0, FastNMAvsNMA);
     SetIndexLabel(0, name);
     SetIndexBuffer(1, SD);
     SetIndexBuffer(2, SD2);
     SetIndexBuffer(3, SD3);
     if(Show_SD_1line_only)
       {
       SetIndexLabel(1, "FastNMAvsNMA_SD(" + SD_len + ")");
       SetIndexLabel(2, "unused");
       SetIndexLabel(3, "unused");
       }
     else
       {
       if(Show_SD_3lines_up) SetIndexLabel(1, "FastNMAvsNMA_SD_up(" + SD_len + ")");
       else                  SetIndexLabel(1, "unused");
       if(Show_SD_3lines_dn) SetIndexLabel(2, "FastNMAvsNMA_SD_dn(" + SD_len + ")");
       else                  SetIndexLabel(2, "unused");
       if(Show_SD_3lines_md) SetIndexLabel(3, "FastNMAvsNMA_SD_md(" + SD_len + ")");
       else                  SetIndexLabel(3, "unused");
       }
     SetIndexBuffer(4, NMA);
     SetIndexBuffer(5, FastNMA);
     return(0);
    }
    
    int start()
    {
     int limit, i, ii, counted_bars = IndicatorCounted()-1;
     int max = MathMax(NMA_period, FastNMA_period);
     double nmasum, nmaabssum, nmaratio, nmmnum, maxnmm, fastnmasum, fastnmaabssum, fastnmaratio, temp;
     bool nmadone, fastnmadone;
    
     if(Bars <= max) return(0);
     if(counted_bars < 0) counted_bars = 0;
     if(counted_bars > max) limit = Bars - counted_bars;
     else                   limit = Bars - max - 1;
    
     for(i = limit; i >= 0; i--)
       {
       if(i == Bars - max - 1) { NMA[i+1] = Close[i+1]; FastNMA[i+1] = Close[i+1]; }
       nmaratio = 0; maxnmm = 0; fastnmaratio = 0;
       int NMA_LB_max;
       for(ii = 1; ii <= FastNMA_period; ii++)
         {
         nmmnum = (MathLog(Close[i]) - MathLog(Close[i+ii])) / MathSqrt(ii);
         if(MathAbs(nmmnum) > maxnmm) { maxnmm = MathAbs(nmmnum); NMA_LB_max = ii; }
         }
       if(NMA_LB_max < FastNMA_LB_min) NMA_LB_max = FastNMA_LB_min;
       nmasum = (MathLog(Close[i]) - MathLog(Close[i+1])) + (MathLog(Close[i+1]) - MathLog(Close[i+2])) * (MathSqrt(2)-1);
       fastnmasum = nmasum;
       nmadone = false; fastnmadone = false; ii = 2;
       while( !(nmadone) || !(fastnmadone) )
         {
         temp = (MathLog(Close[i+ii]) - MathLog(Close[i+ii+1])) * (MathSqrt(ii+1) - MathSqrt(ii));
         if(ii >= NMA_period) nmadone=true;
         else                 nmasum += temp;
         if(ii >= NMA_LB_max) fastnmadone=true;
         else                 fastnmasum += temp;
         ii++;
         }
       nmaabssum = MathAbs(nmasum);
       fastnmaabssum = MathAbs(fastnmasum);
       nmasum = 0; fastnmasum = 0;
       nmadone = false; fastnmadone = false; ii = 0;
       while( !(nmadone) || !(fastnmadone) )
         {
         temp = MathAbs(MathLog(Close[i+ii]) - MathLog(Close[i+ii+1]));
         if(ii >= NMA_period) nmadone=true;
         else                 nmasum += temp;
         if(ii >= NMA_LB_max) fastnmadone=true;
         else                 fastnmasum += temp;
         ii++;
         }
       if(nmasum != 0) nmaratio = nmaabssum / nmasum;
       if(fastnmasum != 0) fastnmaratio = fastnmaabssum / fastnmasum;
       NMA[i] = NMA[i+1] + (Close[i] - NMA[i+1]) * nmaratio;
       FastNMA[i] = FastNMA[i+1] + (Close[i] - FastNMA[i+1]) * fastnmaratio;
       FastNMAvsNMA[i] = FastNMA[i] - NMA[i];
       }
    
     if(Show_SD)
       for(i = limit; i >= 0; i--)
         if(i < Bars - max - 1 - SD_len)
           {
           if(Show_SD_1line_only)
             {
             if(FastNMAvsNMA[i] == 0)     SD[i] = 0;
             else if(FastNMAvsNMA[i] > 0) SD[i] = iBandsOnArray(FastNMAvsNMA, 0, SD_len, SD_up, 0, MODE_UPPER, i);
             else if(FastNMAvsNMA[i] < 0) SD[i] = iBandsOnArray(FastNMAvsNMA, 0, SD_len, SD_dn, 0, MODE_LOWER, i);
             }
           else
             {
             if(Show_SD_3lines_up) SD[i] = iBandsOnArray(FastNMAvsNMA, 0, SD_len, SD_up, 0, MODE_UPPER, i);
             if(Show_SD_3lines_dn) SD2[i] = iBandsOnArray(FastNMAvsNMA, 0, SD_len, SD_dn, 0, MODE_LOWER, i);
             if(Show_SD_3lines_md) SD3[i] = (iBandsOnArray(FastNMAvsNMA, 0, SD_len, SD_up, 0, MODE_UPPER, i)+
                                             iBandsOnArray(FastNMAvsNMA, 0, SD_len, SD_dn, 0, MODE_LOWER, i) ) / 2;
             }
           }
    
     return(0);
    }
    

     

    Source code:

    http://pastebin.com/Yt7EkFbH

     

     

    Hopefully someone will find it useful.

  7. UDC,

     

    Brilliant job with Metatrader Ocean Indicators!!

    I am sure in the not to distant future a lot of us on this forum will be thanking you a lot more after we've done some demo/real trading!

    Any luck with Ocn STX yet? :D

     

    Thank you. I can't give you ETA on STX, it depends when I get time (and mood) for it. I may finish some work sooner, get ahead of the deadline and STX is here, but I really can't predict these things. Even when it looks like something like that is going to happen some other urgent task may appear and if it's business it will have a priority. Stop the clock for 1 day and STX is done 8-) All I can somewhat promise is that I want to finish all Ocean related programming this year, next year I will focus on different thing in my spare time.

     

    I see that it is not in the TSD elite upload.......?

     

    I didn't get this question, what is not in TSD elite?

  8. But just ask yourself if you would not have loved to trade and sustain and develop software at leisure rather than having it the other way around.

     

    No, definitely not. Why would I throw away a successfully established business where I can well utilize several tens of years of education, knowledge and experience, with zero risk involved, and instead start doing something what I have no formal education, no reasonable knowledge and no real experience with, that is the trading on the riskiest market in the world? No one of sound mind would do that. I don't understand where do you get these strange ideas. Let alone the financial impact. You probably are not familiar with the salaries in the software development industry, but don't you really have at least a vague idea what might be a programming hourly rate of someone at my level? Then do some research and you will get the idea! I very doubt I would make the same by trading and even if I would I wouldn't want to do it because of the physical and psychological impact this kind of stressful work has on the human body and mind. I love programming, it's my hobby and at the same time I am very decently paid for that. No reason to change anything. There is a saying: "don't fix what's not broken".

  9. then , this is the whole ocean theory indicators hope you winning trading

     

    These are the Ocean Classics indicators from TSD elite, that's what I was looking for when I created this thread almost a half year ago. Unfortunately no one came up with them then so I had to program them myself. Anyway it's great we finally get those, many thanks!

  10. UDC------

     

    I only wanted to point out why i do not trade FOREX.

     

    And that's perfectly ok as long as you don't offend others with your opinions. Your freedom (of speech) ends at the moment when it starts disturbing freedom of anyone else. You can have any opinion you want to have but you can't tell in front of thousands people that trading Forex is nonsense, or nearly nonsense, because:

     

    1) Who are you to say that? A God? A generally accepted authority? Even you yourself admit you don't know Forex, you don't trade it and in your whole life you checked just a few Forex charts, yet in some totally inexplicable way you feel competent, educated and experienced enough to say to people what is good and what is bad and what they "should" and "should not" do.

     

    2) Even if you were right (which you are not) and were the authority, the God, the know-it-all genius, you simply can't tell or imply that people are i.d.i.o.t.s because it's not the way a decent person with a minimum of good manners would behave.

     

    I really don't understand why I should explain to you, (supposedly) an adult person, what even little kids already know. If you still don't get it that's a pity but I will not discuss this subject anymore.

     

     

     

    I will comment one more statement of yours because you said it repeatedly. You somehow seem to believe that making a profitable trade means "to rip the riches" or in other words that to make money means that someone else looses money (that you, so to speak, "steal" money from him). Sorry to say that but that's a huge misunderstanding. All you do as a trader is buying and selling, or more precisely - accepting offers and bids that are on the market. These offers and bids are already on the market which means that if you won't take them someone else will. Just this simple fact explains why you can't possibly "rip" anyone while trading, it's a logical nonsense.

    But let's go on with this children-level explanation: a profit or loss is not and can not be calculated from a single trade (a buy or a sell). You need to make at least 2 trades - buy and then sell, or sell and then buy. So as a trader what you do is you make the first trade (buy or sell). At this point you didn't "rip" anyone and neither you possibly could. Also at this point you can't possibly calculate any profit or loss, not yet, it's impossible. Then after some time you make the second trade (sell or buy). From market's point of view this second trade of yours bears no relation to your first trade whatsoever, also your market counterside is most probably someone else than the one from your first trade (and even if it was the same subject it wouldn't matter at all anyway because he is willingly making an offer or a bid) so you again didn't and couldn't "rip" anyone. Only after both trades are done you, and only you, can sum both trades together and only then you can find out whether you actually made a profit or a loss. And still you didn't rip anyone, neither anyone ripped you.

     

     

     

    Now considering all your opinions if I was to demonstrate your own behavior I would tell you something like this:

     

    Well if you are that smart, if you know that much (as you are trying so hard to prove), if you know that many facts, strategies, books and persons, if 100% return per month is cakewalk for you, if everything is so clear and straightforward to you, then you surely must be a successful trader, a multi-millionaire if not a multi-billionaire, right? No? Well then you are obviously not that smart and don't know that much and all that is obviously not that simple as you are trying to picture.

     

    How does this feel? Not great, right? Now even though I would have reasons to say something like that I will never say such a thing simply because that's not what a decent person says. I hope you finally get it.

     

     

     

    ( And I never really checked that this forum is about FOREX traders, so really sorry if I offended people that way)

     

    Just 2 facts: 1) the Metatrader subforums are the biggest here, 2) the vast majority of Metatrader brokers are Forex brokers.

     

     

    I mean why don't you consider yourself a trader?

     

    That would first need to define "a trader". Short answer: I consider it a profession, the same as any other profession in the world, and "a profession" in my view is an activity you do for living. I don't trade for living, thus I am not a trader. Long answer: I am a programmer, I get decent money off it and I do it for 26 years now. It just happened that along all other programming work I also program tools for financial market data mining and data analysis. Why should I even start thinking about becoming a trader? If I program a software for a medical area should I all of sudden end my programming career and become a doctor? If I program a software used within a criminal investigations should I all of sudden end my programming career and become a criminal investigator? Programming a scientific or economic software won't all of sudden transform me into a scientist nor a economist. Sure I need to understand some outline basics of given field to understand the functions of the software, it may give me some insights, maybe even some "inside" knowledge, but that's about it.

     

    I admit I do have some personal interest in financial market analysis, namely Forex price feed analysis, I do some research and programming in this area just for myself, that's at the end the reason why I took interest in the Ocean tools, but I can't reveal my opinions or my present results simply because someday I may use it commercially in one way or another.

  11. You call them bucket shops because that's what they are. They take money from the people and let them play on demo saying it's for real *. So if you manage to do a successful trade, they pay you. Otherwise they simply keep all the money. That's nothing new, you didn't discover America, nor it takes a doctorate to realize that, just a simple common sense. And there is totally nothing wrong with that, in fact they would be s.t.u.p.i.d if they tried to behave differently, if they actually tried to pass those trades to the market, let alone the impossibility because no one in the market would be interested in those ridiculously small trades from retail traders anyway. So those "brokers" take your money and keep it all and if you win a trade they pay you back. And sure they pay you, most of them do nowadays, why wouldn't they if the vast vast majority of traders loose everything anyway so why the brokers wouldn't pay those very very few who win? They still make an amazing profit anyway, for nothing, for totally nothing. Officially they are called market-makers, in reality all they do is absolutely nothing. Still there is nothing really wrong with that, it's a great business.

     

    (* That's maybe a single dishonest thing, still very debatable because it doesn't have any real negative consequence. It's so little and so obvious lie like for example when the sellers fabricate those fake discounts. e.g. a product X: original price $100, now $39.99, 60% discount. Everyone with a healthy mind must realize that the product X has never ever been sold for $100. Everyone knows that, yet the sellers will keep doing this charade anyway and at the end why not? There is no real harm. The same is with this pretending that you are actually really trading on the market. You don't and it does not matter anyway, not a bit.)

     

    Trading 24 hours market is tough? No one argues with that! Then don't do it, no one forces you to do it. But I repeat again: don't blame the market, don't blame the leverage, don't blame the brokers. All that is nonsense, none of that is a valid argument for a failure in trading. The only possible reason for fail is simply because you don't know how to be a successful trader in Forex, that's all, and if you are smart then you of course don't do what you are not good at and do something else instead, that's again just a common sense. If you are s.t.u.p.i.d then you do it anyway even though you know you don't know how to and then you deserve to lost everything.

     

     

    So if you don't like Forex that's fine. If you don't know how to be a successful trader in Forex that's fine. You prefer trading other markets where you actually do know how to be successful? That's fine and the only logical thing to do, kudos to that. But don't use false arguments to explain why trading Forex is bad or why it shouldn't be traded and don't you ever again dare to say that it's impossible because saying that you spit on everyone who is trying to trade Forex, you spit on this whole forum. There do exist people who are successful in Forex trading and a much bigger crowd of people who are trying to get there too and you have no right to deny their success nor their effort nor to put them down. I don't consider myself a trader but even I feel offended by your comments, how must be feeling they whose effort you are negating? I hope you didn't mean it that way but please just read what you write before you hit the "reply" button. There are 38193 registered people on this forum, please be considerate with them. I may sound strong too sometimes but all what I am saying to people - and I am saying it for tens of years - is "don't be s.t.u.p.i.d, use your brain" but I would never try to discourage or even ridicule or put down anyone who is trying to do something just because I don't understand it or I wouldn't do it myself.

  12. Wildeazoscar, I have received your e-mail, thanks.

    You are right the Forex is a killer but it's not the market's fault. Also there is totally nothing wrong with brokers offering a leveraged trading. Normally to buy 100000 EUR you would be required to have 124037 USD. All what broker says is that you are not required to have that much, you need only 10 times, or 50 times, or 200 times, or even 1000 times less. But no one says you shouldn't have 124037 USD and instead have only those x times less. No one says that! It's the same as you are not required to have a job but no one says you shouldn't have one. You are not required to carry an umbrella when it's raining but no one says you shouldn't carry one. Brokers offer just a possibility how much you can leverage your trading but it's totally up to you and you only how much leverage you will actually use and if you use that possibility at all. There is no fault on the broker's side. It's only the people's s.t.u.p.i.d.ity, if they don't understand what leveraged trading is and do it anyway then they deserve no better than to lost all their money, to the last cent. It's like a money borrowing. You can borrow from here, from there, you can borrow a lot. But no one says you should borrow a lot. Now if you borrow that much that you can never ever pay it back and spend it in unproductive way then, well, then you are just plain and simple s.t.u.p.i.d and you deserve to lost everything and face the consequences to the rest of your life. A debt can a good thing if used wisely, the same as leveraged trading, the same as a fire. There as well is nothing wrong with bucket shops instead of real brokers. It doesn't matter at all that there is zero difference between a demo account and a "real" account and that people's supposed trades never reach any market because even when they think they really trade they in fact still just play a demo. There is nothing wrong with that and it doesn't matter at all, as long as the broker (or "broker") pays. So please don't blame people's endless s.t.u.p.i.d.ity on brokers or on anyone or anything else than on them themselves.

  13. Yeah, most instruments are quoted in USD so their price is affected not only by supply and demand for that particular instrument but also by the development in USD itself. If gold goes up it may be because of higher demand for gold, or simply because USD got weaker (lost its value). Now if you trade it in other than USD currency that's even another factor in play. Forex is simpler, there are just 2 currencies in a pair. What's funny is that in fact Forex is not really simpler at all. One of the analytical software I developed (commercial, so I can't even show a screen-shot) measures all trade-able currency pairs traded on Forex (it makes something like a matrix with all possible mutual combinations, weighting what progress each of them does and converting that to some comparable values, eventually reversing the development back into particular currencies) and it's actually interesting to see what development in other currencies is related to a development in some particular pair. Sometime I have it running on one of my screens, just for fun, it's updated in milliseconds so you can see very precisely what's going on, and it's really interesting that sometimes if there is a move for example in EUR/USD then only EUR and USD are "responsible" for that move, but some other times the other at first thought totally unrelated currencies are moving as well. I imagine that's the money flow. Like the day before yesterday when NFP came out, there was a terrible fall in JPY's value, even bigger than in USD's. I suppose the players were selling JPY and buying EUR, even more than they were exchanging USD for EUR. But yet again I don't really understand these things, I am just a programmer, but nevertheless it's interesting to watch the market in this somewhat "decrypted" way.

     

    Well, the way you do your analysis in Amibroker should really be do-able in Metatrader. Metatrader does have a volume field, however when using Forex data it represents the amount of ticks (how many times the quote changed) of given bar. But if your offline data contains real volume I don't see any reason why it couldn't be used that way. Then indicators like OBV will finally work the way they were supposed to.

     

    Ok, I installed Amibroker 5.5, it seems it's working alright. Now could you please send me ([email protected]) some data to import and maybe also your indicators in .afl files so I could avoid all possible errors. The best would be if you could also send me the screen-shot of what am I supposed to see after correctly applying your data and your indicators. Then I will try to get the identical picture onto Metatrader so we can move forward.

  14. Wildeazoscar, now you talking! Excellent =D>

     

    When you say you are using offline data off the exchange, does that mean that you are not actually trading with the real-time charts? So what you do is you download data from the exchange, make charts of them, apply your indicators, do your technical analysis and based on that you open/close/adjust your trading positions and that's it and you go doing something else until in specified interval you repeat the whole process? What instruments are you actually trading then? Commodities?

    Have you chosen Amibroker because that's what your broker uses? But why don't you use your broker's data feed? Is it that bad (or the data directly from the exchange is that better)?

     

    Importing external data into offline Metatrader charts is possible and if not directly I can make some conversion tool for you. Well, I should probably start from where you are now, i.e. to get on my screen what you currently have on your screen. That way the transition from Amibroker to Metatrader would be the easiest. Could you advice me where should I get Amibroker from and how to install it to make it look and work as close as possible to your installation? Could you also provide me with some sample of the data you are using or the download link in case it's freely available?

  15. Wildeazoscar, you seem like a smart guy, maybe we will get somewhere. Your previous fiddling with STX and now further with other Ocean tools looks interesting. I can't unfortunately answer your trading-related questions as I don't consider myself to be an authority in that area. So you are saying STX is not very interesting after all?

     

    If you are willing to share and show me your source codes (no matter what programming language or platform) I can port them onto Metatrader, that would expand your think-tank by thousands as Metatrader has very huge user base as far as retail trading goes.

  16. Would you be kind enough to explain the NMC ( am again at a loss at how it is programmed) and the three bounded Tools (i.e. NDX, NST and NXC)

     

    I do not think you found the logic behind either STX or the BTX ( I would try to find the logic that makes the ADX non-arbitrary after i grasp the codes)

     

    Do check the BTX and STX uses in Ocean Pro Charts ( manyblessings has them for Copper ----- it is a natural extension of Schabbe's work on ADX)

     

    Lastly, do u have any inkling about the way they set up the STX3 and shadow line, the STX7 and the Component4 ? ( it is the Oceanmasters tool)------ once the STX is decoded, i think we can make a go for that

     

    Thanks again for your selfless help

     

    Well, NMC is a combination of NMM and NMR. Those two you probably understood from the videos.

     

    NMM:

    sum = sum + ( log(close[0]) - log(close[1] ) / sqrt(1)
    sum = sum + ( log(close[0]) - log(close[2] ) / sqrt(2)
    ...
    sum = sum + ( log(close[0]) - log(close[40] ) / sqrt(40)
    
    NMM[0] = ( sum / 40 ) * 1000

     

    NMR:

    sum = sum + ( log(close[0]) - log(close[1] ) * ( sqrt(1) - sqrt(0) )
    sum = sum + ( log(close[1]) - log(close[2] ) * ( sqrt(2) - sqrt(1) )
    ...
    sum = sum + ( log(close[39]) - log(close[40] ) * ( sqrt(40) - sqrt(39) )
    
    NMR[0] = sum  * 1000

     

    Then to calculate NMC you just multiply NMM and NMR with each other, you do it twice and each time one of those two is taken as an absolute value, then you average the two results of multiplying, then you remember if that result was positive or negative, do a square root of absolute value of that result and lastly set it negative or positive according to what you remembered. In code it looks like this:

    avg = ( abs(NMM) * NMR + NMM * abs(NMR) ) / 2
    if (avg > 0) sign = 1
    if (avg < 0) sign = -1
    NMC[0] = sign * sqrt( abs(avg) )

     

     

    If you understand pseudocode in this and my previous post then you will understand the Metatrader source codes I published here. It's basically just an ordinary C language. Check it out for the logic of NDX/NST/NXC because I don't really want to explain those.

     

     

    As for STX/BTX there is no need to find any logic behind and actually it's not really possible because all the calculation is done in the external DLL so all what the TradeStation code does is just sending various numbers to the DLL, get some numbers back, then send them again to the DLL and so on and so forth and after many iterations you get the BTX or STX value. If you can call external DLL from your trading platform then you can rewrite it without any real problem. I did that for BTX and BTX_2line, it's working fine on Metatrader. The only problem is that the code (and thus rewriting of such code) is very annoying. It's even annoying to just look at it. Maybe it's just me but dealing with this kind of obfuscated code really bothers me that much that it takes all my enthusiasm away. Just look yourself what BTX_2line main loop in TradeStation looks like:

          FOR Variable1 = 1 TO 40 
         BEGIN
            Variable9[Variable1] = LTCalcVal (Price[Variable1], Price[Variable1-1], 0.5, CLOSE, "mmGBBJhfgg") ;
            IF (Variable9[Variable1-1]-Variable9[Variable1]) > 0 THEN Variable10[Variable1] = LTCalcVal (Variable9[Variable1-1], Variable9[Variable1], CLOSE, 0.5, "qUGecBBMD") ELSE Variable10[Variable1] = 0 ;
            IF (Variable9[Variable1-1]-Variable9[Variable1]) < 0 THEN Variable11[Variable1] = LTCalcVal (Variable9[Variable1-1], Variable9[Variable1], CLOSE, 0.5, "hrmGMBBceDf") ELSE Variable11[Variable1] = 0 ;
            Variable12[Variable1] = LTCalcVal (Variable12[Variable1-1], Variable10[Variable1], 0.5, CLOSE, "F9mGMcehfft") ;
            Variable13[Variable1] = LTCalcVal (Variable13[Variable1-1], Variable11[Variable1], 0.5, CLOSE, "F9mGMcehfft") ;
            IF (Variable9[0]-Variable9[Variable1]) > 0 THEN Variable14[Variable1] = IFF (Variable12[Variable1] = 0, 0, LTCalcVal (Variable9[0], Variable9[Variable1], Variable12[Variable1], Variable10[Variable1], "CqdGMDBBXUfA")) ELSE Variable14[Variable1] = 0 ;
            IF (Variable9[0]-Variable9[Variable1]) < 0 THEN Variable15[Variable1] = IFF (Variable13[Variable1] = 0, 0, LTCalcVal (Variable9[0], Variable9[Variable1], Variable13[Variable1], Variable11[Variable1], "FmGMBBDXUfa")) ELSE Variable15[Variable1] = 0 ;
            Variable16[Variable1] = 1/LTCalcVal (0.5, Variable1, Variable14[Variable1], Variable15[Variable1], "UhWGceMBBJn") ;
            Variable17[Variable1] = LTCalcVal (Variable14[Variable1], Variable16[Variable1], Variable14[Variable1-1], Variable12[Variable1], "BBWGMecqfrr") ;
            Variable18[Variable1] = LTCalcVal (Variable15[Variable1], Variable16[Variable1], Variable15[Variable1-1], Variable13[Variable1], "ceGWWMBBqffr") ;
            Variable2 = LTCalcVal (Variable2, Variable17[Variable1], Variable17[Variable1-1], Variable2[1], "ceGMhftTds") ;
            Variable3 = LTCalcVal (Variable3, Variable18[Variable1], Variable18[Variable1-1], Variable3[1], "ceGMhftTds") ;
            Variable4 = LTCalcVal (Variable4, Variable16[Variable1], Variable2, Variable4[1], "jTGceMBBhffv") ;
            Variable5 = LTCalcVal (Variable5, Variable16[Variable1], Variable3, Variable5[1], "jTGceMBBhffv") ;
         END ;
         
         Variable7 = LTCalcVal (Variable2, Variable4, 100, 0.5, "mGBBMUceXq") ;
         Variable8 = LTCalcVal (Variable3, Variable5, 100, 0.5, "mGMUXecqfUr") ;
         oBTX.P = $Tema2UF (Variable7, SmLen) ;
         oBTX.N = $Tema2UF (Variable8, SmLen) ;

     

    Basically all what it is doing is just calling the LTCalcVal function which is inside the DLL. I had to rewrite the above into the following Metatrader code:

          for(ii = 1; ii <= BTX_period; ii++)
           {
           arr9x[ii] = LTCalcValx(dll, Close[i+ii], Close[i+ii-1], 0.5, Close[i], "mmGBBJhfgg");
           if((arr9x[ii-1]-arr9x[ii]) > 0) arr10x[ii] = LTCalcValx(dll, arr9x[ii-1], arr9x[ii], Close[i], 0.5, "qUGecBBMD");
           else                            arr10x[ii] = 0;
           if((arr9x[ii-1]-arr9x[ii]) < 0) arr11x[ii] = LTCalcValx(dll, arr9x[ii-1], arr9x[ii], Close[i], 0.5, "hrmGMBBceDf");
           else                            arr11x[ii] = 0;
           arr12x[ii] = LTCalcValx(dll, arr12x[ii-1], arr10x[ii], 0.5, Close[i], "F9mGMcehfft");
           arr13x[ii] = LTCalcValx(dll, arr13x[ii-1], arr11x[ii], 0.5, Close[i], "F9mGMcehfft");
           if((arr9x[0]-arr9x[ii]) > 0) { if(arr12x[ii] == 0) arr14x[ii] = 0; else arr14x[ii] = LTCalcValx(dll, arr9x[0], arr9x[ii], arr12x[ii], arr10x[ii], "CqdGMDBBXUfA"); }
           else                         arr14x[ii] = 0;
           if((arr9x[0]-arr9x[ii]) < 0) { if(arr13x[ii] == 0) arr15x[ii] = 0; else arr15x[ii] = LTCalcValx(dll, arr9x[0], arr9x[ii], arr13x[ii], arr11x[ii], "FmGMBBDXUfa"); }
           else                         arr15x[ii] = 0;
           arr16x[ii] = 1 / LTCalcValx(dll, 0.5, ii, arr14x[ii], arr15x[ii], "UhWGceMBBJn");
           arr17x[ii] = LTCalcValx(dll, arr14x[ii], arr16x[ii], arr14x[ii-1], arr12x[ii], "BBWGMecqfrr");
           arr18x[ii] = LTCalcValx(dll, arr15x[ii], arr16x[ii], arr15x[ii-1], arr13x[ii], "ceGWWMBBqffr");
           var2x = LTCalcValx(dll, var2x, arr17x[ii], arr17x[ii-1], var2x, "ceGMhftTds");
           var3x = LTCalcValx(dll, var3x, arr18x[ii], arr18x[ii-1], var3x, "ceGMhftTds");
           var4x = LTCalcValx(dll, var4x, arr16x[ii], var2x, var4x, "jTGceMBBhffv");
           var5x = LTCalcValx(dll, var5x, arr16x[ii], var3x, var5x, "jTGceMBBhffv");
           }
         RawBTXp[i] = LTCalcValx(dll, var2x, var4x, 100, 0.5, "mGBBMUceXq");
         RawBTXn[i] = LTCalcValx(dll, var3x, var5x, 100, 0.5, "mGMUXecqfUr");

     

    Now because Metatrader is s.t.u.p.i.d I couldn't call LTCalcVal function directly, instead I had to write my own DLL with LTCalcValx function which is callable from within Metatrader and which in turn calls the original LTCalcVal function from the Ocean DLL. And on top of that this Ocean DLL doesn't work in Windows 7 64bit, you need Windows XP.

     

    Now code for STX is about twice as much longer and uglier as BTX is :-/ But I still think I will rewrite it onto Metatrader some day, just I wish someone else would do that instead as it's really just annoying.

     

     

    Stuff from Ocean master software haven't leaked yet, or at least none I have heard of, so can't really say anything to it. I suppose it will be again implemented via some external DLL thus it may be well again possible to rewrite it to other trading platforms, although I guess the complexity and the ugliness of the code will be even higher.

  17. UDC did a fabulous job here. Just for poor guys like me who are hooked to AMIBROKER, can the Basic Logic of Indicators statring from NMA( Regular) be posted in plain English. I found the book as well as lectures to be ok with programming Ocen Indices, NMM and NMR. After that the book is very sketchy on NMA, and the video does not have a clue on how the NMA is built.

     

    Thank you for your kind words. As for the NMA explanation, you are right it's a bit harder to grasp. Pat is trying to explain it in the video, I believe it's in the beginning of the first one but it's not explained in full, or if I remember correctly he just explains there the principle of natural market mirror (which is in fact the core of natural MA).

     

    So NMA in plain english:

     

    We start at the 41st bar from the left and let's call this bar "the current bar". So we skip first 40 most oldest bars because we will use them for calculation of "the current bar".

    We will use relative numbering and we will number the bars in descending order, so the bar we are calculating NMA for will always have a relative number 0 and the bars used for that calculation will have relative numbers 1 (a previous from "the current") up to 40 (40 bars to the past from "the current").

     

    Let's take a variable called sum, set it initially to 0 and add the natural logarithm of CLOSE of the previous bar subtracted from log of the current CLOSE. So we get:

    sum = log(close[0]) - log(close[1])

     

    Now we go on and add a difference of logs of bars 1 and 2 multiplied by (the square root of 2, decreased by 1). So we get:

    sum = sum + ( log(close[1]) - log(close[2]) ) * ( sqrt(2) - 1 )

     

    From here we keep going similarly with the subsequent (previous) bars always multiplying by the differences of square roots of their relative bar numbers, like this:

    sum = sum + ( log(close[2]) - log(close[3]) ) * ( sqrt(3) - sqrt(2) )
    sum = sum + ( log(close[3]) - log(close[4]) ) * ( sqrt(4) - sqrt(3) )
    ...
    sum = sum + ( log(close[39]) - log(close[40]) ) * ( sqrt(40) - sqrt(39) )

     

    Now we take another variable, let's call it abssum, and set it to the absolute value of variable sum.

     

    Now we can reset sum back to 0 and reuse it for yet another summing, this time we will sum up the absolute values of the log differences, like this:

    sum = sum + abs( log(close[0]) - log(close[1]) )
    sum = sum + abs( log(close[1]) - log(close[2]) )
    ...
    sum = sum + abs( log(close[39]) - log(close[40]) )

     

    Now we take the third variable, let's call it ratio, set it to 0 and if sum is not 0 then let's divide abssum by sum and the result store into ratio, like this:

    ratio = abssum / sum

     

    Now the NMA value for the current bar, i.e. NMA[0], will be NMA of the previous bar plus (the previous NMA subtracted from the current close, and the result multiplied by ratio), like this:

    NMA[0] = NMA[1] + ( close[0] - NMA[1] ) * ratio

     

    That's all the magic.

     

    Now there is a little catch because for the current NMA calculation we always use the previous NMA value but at the very beginning when we calculate NMA the first time we don't have any previous NMA. I.e. we start calculating NMA at the 41st bar from the very left but we are supposed to use NMA of the 40th bar to calculate it. We don't have and can't have NMA of the 40th bar so if you kept it like that your NMA of the 40th bar would most probably be 0 and as a result of that it would take some time on the chart before the indicator would calibrate itself.

     

    So in my implementation I fixed it in a way that NMA of the 40th bar from the very left is equal to the close of that bar, in other words - the very first time I am supposed to use previous NMA value (which in fact was never calculated) I simply use the price instead.

  18. Well, here are the files uploaded to some 20 mirrors, hope you will find your favorite filehost there and the links will last for some time.

     

    Introduction ebook:

    http://directmirror.com/files/1BQBULOZ

    http://mir.cr/1FLIECZS

    http://www.multiupload.nl/42MG3EY4Q4

     

    Whole package except the videos:

    http://directmirror.com/files/04K5S9GP

    http://mir.cr/YOI1I1N8

    http://www.multiupload.nl/064AF3KISR

     

    Ocean Theory DVD1:

    http://directmirror.com/files/0DQQPJOP

    http://mir.cr/EOLXJHI3

    http://www.multiupload.nl/321UZNXR1V

     

    Ocean Theory DVD2:

    http://directmirror.com/files/01XVRFMD

    http://mir.cr/0MHQU4RV

    http://www.multiupload.nl/F5OXIVZ3YL

     

    Ocean Theory DVD3:

    http://directmirror.com/files/8IRKEBFV

    http://mir.cr/05QOP0ND

    http://www.multiupload.nl/A9LYPTLJT0

     

    Ocean Theory DVD4:

    http://directmirror.com/files/04ALHVZY

    http://mir.cr/N9IXGHLG

    http://www.multiupload.nl/4JHJB1O2A0

     

    Ocean Theory DVD5:

    http://directmirror.com/files/JYGPSAZB

    http://mir.cr/SVEJEZGF

    http://www.multiupload.nl/IA5XT6BDVG

     

    Ocean Theory DVD6:

    http://directmirror.com/files/AKLWMKIN

    http://mir.cr/1DVKJ2RB

    http://www.multiupload.nl/9MEU0YL4P7

     

    Ocean Theory DVD7:

    http://directmirror.com/files/FXSO6LQA

    http://mir.cr/0VG1G1JA

    http://www.multiupload.nl/NPO0QBGLGC

     

    Ocean Theory DVD8:

    http://directmirror.com/files/ISBDNGPK

    http://mir.cr/2BMWLOKC

    http://www.multiupload.nl/OI4WCTIZJX

     

    Ocean Theory DVD9:

    http://directmirror.com/files/0F9FXBFY

    http://mir.cr/OX5YBNLX

    http://www.multiupload.nl/LQE2PYO90F

     

    Ocean Theory Bonus DVD:

    http://directmirror.com/files/KJCZQMNG

    http://mir.cr/1FVNAMVE

    http://www.multiupload.nl/3D53IVSBE1

×
×
  • Create New...