SpacyTrader Posted April 2, 2012 Report Share Posted April 2, 2012 (edited) @udc You said you didnt understand what the governments interest was in the bubbles and could see why the banks would want them. Think of it this way- you own or control almost all the wealth in a country together with a small group of other like minded people. Now, is it conceivable that you'd allow a third party to run the place and do as they please against your interests ? The politicians that are presented to the public are mostly pre-selected by a party machine, dependent on funding from donors and also dependent on corporate mass-media support. What chance is there anybody gets to hold any real power without your approval ? Edited April 2, 2012 by SpacyTrader Quote Link to comment Share on other sites More sharing options...
Grain Trader Posted April 2, 2012 Report Share Posted April 2, 2012 Nope.meta trader. Thanks Chandu Quote Link to comment Share on other sites More sharing options...
udc Posted April 2, 2012 Author Report Share Posted April 2, 2012 SpacyTrader: what you are saying is that governments are fake, they are just puppets controlled by the people behind the curtain who actually hold the real power. That corresponds with the "conspiracy theory" I stated and therefore I said: if that's really the case then they should simply cancel all those puppet governments right away and rule directly. It's just pointless to have fake governments, it serves no good to anyone, not even to those puppetmasters who are really in charge. There is no reason why they shouldn't rule directly. I am not happy about it but it would be simply better if we all knew what's really the reality. You see, we are paying taxes to fake powerless governments. Doesn't it bother you? If I must pay taxes to anyone, instead of supporting fakes I would rather pay it to the real rulers. I would feel better, at least I would know who to hate. I am not saying they should come forward and say their names and show their faces, they could stay behind some nickname or whatever, but they should simply remove the fake powerless middlemen. You see my point? The current situation is just s t u p i d . If we have to live in the corporatocracy then let's be it, do it, say it, make it clear and get it over with. What is now is just schizophrenic pointless theater. Quote Link to comment Share on other sites More sharing options...
metal1713006284 Posted April 2, 2012 Report Share Posted April 2, 2012 can anyone explain why do I see only three line of the indicator instead of five thanks Quote Link to comment Share on other sites More sharing options...
chandu1713006579 Posted April 2, 2012 Report Share Posted April 2, 2012 can anyone explain why do I see only three line of the indicator instead of five thanks Make sure you enabled 'allow dll imports' and indicators colours not same as back ground colour. Thanks. for-ex 1 Quote Link to comment Share on other sites More sharing options...
metal1713006284 Posted April 2, 2012 Report Share Posted April 2, 2012 thanks chandu,for reply, but nothing changed, but thanks anyway Quote Link to comment Share on other sites More sharing options...
Danny Posted April 2, 2012 Report Share Posted April 2, 2012 can anyone explain why do I see only three line of the indicator instead of five thanks Hi metal Indicator works nicely with all color ! What is the MT4 version you are using b'coz latest build 418 has bugs and so many complaints reported their site. Please check this link if you have Build 418 problem : http://pipburner.com/metatrader-build-418-bug-alarm-how-to-switch-back-to-previous-version/ - metal1713006284, for-ex and tsar 3 Quote Link to comment Share on other sites More sharing options...
metal1713006284 Posted April 2, 2012 Report Share Posted April 2, 2012 (edited) thanks Danny I have 418, thats why its not showing now it works perfectly,bless you for your help, great indicator and thanks chandu for trying to help Edited April 2, 2012 by metal Quote Link to comment Share on other sites More sharing options...
Alexander Collins Posted April 2, 2012 Report Share Posted April 2, 2012 Hi metal Indicator works nicely with all color ! What is the MT4 version you are using b'coz latest build 418 has bugs and so many complaints reported their site. Please check this link if you have Build 418 problem : http://pipburner.com/metatrader-build-418-bug-alarm-how-to-switch-back-to-previous-version/ - Danny, Thanks for mentioning my article. Have a good trading week. tsar 1 Quote Link to comment Share on other sites More sharing options...
Danny Posted April 3, 2012 Report Share Posted April 3, 2012 Danny, Thanks for mentioning my article. Have a good trading week. My pleasure Sir Actually i have to say Thank You for your great help to all the trading community around the world. Danny Quote Link to comment Share on other sites More sharing options...
udc Posted April 5, 2012 Author Report Share Posted April 5, 2012 NMA for MT4 Well, since no one seems to either have access to the advanced elite section of the TSD forum, or isn't willing to share, I started reprogramming Ocean Theory indicators from TradeStation to Metatrader myself, first one is NMA. I may do a couple more and that's it because the TradeStation code is annoying. Original NMA on TradeStation: http://img404.imageshack.us/img404/3062/nmatradestation.png NMA on Metatrader: http://img69.imageshack.us/img69/2483/nmametatrader.png Original size screenshots: http://img521.imageshack.us/img521/3062/nmatradestation.png http://img19.imageshack.us/img19/2483/nmametatrader.png For some reason I can't post an attachment so I just paste the code here: #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Yellow #property indicator_color2 Gray #property indicator_color3 Gray extern int NMA_period = 40; extern bool Show_SD = true; extern int SD_len = 30; extern double SD_up = 2; extern double SD_dn = 2; double NMA[]; double SDup[]; double SDdn[]; int init() { string nmaname = "NMA(" + NMA_period + ")"; string sdname = "NMA_SD(" + SD_len + ")"; IndicatorShortName(nmaname); IndicatorBuffers(3); SetIndexBuffer(0, NMA); SetIndexLabel(0, nmaname); SetIndexBuffer(1, SDup); SetIndexLabel(1, sdname+"_up"); SetIndexBuffer(2, SDdn); SetIndexLabel(2, sdname+"_dn"); return(0); } int start() { int limit, i, ii, counted_bars = IndicatorCounted(); if(Bars <= MathMax(NMA_period, SD_len)) return(0); if(counted_bars < 0) counted_bars = 0; if(counted_bars > MathMax(NMA_period, SD_len)) limit = Bars - counted_bars; else limit = Bars - MathMax(NMA_period, SD_len) - 1; for(i = limit; i >= 0; i--) { double sum, abssum, ratio; sum = (MathLog(Close[i]) - MathLog(Close[i+1])) + (MathLog(Close[i+1]) - MathLog(Close[i+2])) * (MathSqrt(2)-1); for(ii = 2; ii < NMA_period; ii++) sum += (MathLog(Close[i+ii]) - MathLog(Close[i+ii+1])) * (MathSqrt(ii+1) - MathSqrt(ii)); abssum = MathAbs(sum); sum = 0; for(ii = 0; ii < NMA_period; ii++) sum += MathAbs(MathLog(Close[i+ii]) - MathLog(Close[i+ii+1])); if(sum != 0) ratio = abssum / sum; NMA[i] = NMA[i+1] + (Close[i] - NMA[i+1]) * ratio; if(Show_SD) { SDup[i] = NMA[i] + SD_up * iStdDev(Symbol(), Period(), SD_len, 0, 0, PRICE_CLOSE, i); SDdn[i] = NMA[i] - SD_dn * iStdDev(Symbol(), Period(), SD_len, 0, 0, PRICE_CLOSE, i); } } return(0); } The source code is also available for download here: http://pastebin.com/6iN4YdH5 Please suggest which Ocean indi would be the most useful to reprogram to Metatrader. chandu1713006579, tgt123, mashki and 11 others 14 Quote Link to comment Share on other sites More sharing options...
tgt123 Posted April 5, 2012 Report Share Posted April 5, 2012 Thank you very Much uds.. It seems in video that NMC and NMS used alot for signal entry. we at indo here would like uds do us a favour thank in advance Quote Link to comment Share on other sites More sharing options...
Grain Trader Posted April 5, 2012 Report Share Posted April 5, 2012 hi udc, you are an excellent programmer, great job. Do you have the new Ocean indicators for TS Quote Link to comment Share on other sites More sharing options...
for-ex Posted April 5, 2012 Report Share Posted April 5, 2012 Thanks for the NMA udc..great job Quote Link to comment Share on other sites More sharing options...
udc Posted April 5, 2012 Author Report Share Posted April 5, 2012 NMM Ocean Index for MT4 Next one is the NMM Ocean Index. A slight discrepancy (i.e. a missing SD band's zero cross from below on 3/29) is due to the differences in price feeds, the math is correct. Original NMM Ocean Index on TradeStation: http://img195.imageshack.us/img195/7533/oceanindextradestation.png NMM Ocean Index on Metatrader: http://img853.imageshack.us/img853/438/oceanindexmetatrader.png Original size screenshots: http://img651.imageshack.us/img651/7533/oceanindextradestation.png http://img40.imageshack.us/img40/438/oceanindexmetatrader.png #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Magenta #property indicator_color2 Silver #property indicator_level1 0 #property indicator_levelcolor Gray #property indicator_levelstyle 2 extern int NMM_LB = 21; extern bool Show_SD = true; extern int SD_len = 30; extern double SD_up = 2; extern double SD_dn = 2; double NMM[]; double SD[]; int init() { string nmmname = "NMM_Ocean_Index(" + NMM_LB + ")"; string sdname = "NMM_Ocean_Index_SD(" + SD_len + ")"; IndicatorShortName(nmmname); IndicatorBuffers(2); SetIndexBuffer(0, NMM); SetIndexLabel(0, nmmname); SetIndexBuffer(1, SD); SetIndexLabel(1, sdname); return(0); } int start() { int limit, i, counted_bars = IndicatorCounted(); if(Bars <= NMM_LB) return(0); if(counted_bars < 0) counted_bars = 0; if(counted_bars > NMM_LB) limit = Bars - counted_bars; else limit = Bars - NMM_LB - 1; for(i = limit; i >= 0; i--) NMM[i] = (MathLog(Close[i]) - MathLog(Close[i+NMM_LB])) / MathSqrt(NMM_LB) * 1000; if(Show_SD) for(i = limit; i >= 0; i--) if(i < Bars - NMM_LB - 1 - SD_len) { if(NMM[i] == 0) SD[i] = 0; else if(NMM[i] > 0) SD[i] = iBandsOnArray(NMM, 0, SD_len, SD_up, 0, MODE_UPPER, i); else if(NMM[i] < 0) SD[i] = iBandsOnArray(NMM, 0, SD_len, SD_dn, 0, MODE_LOWER, i); } return(0); } The source code is also available for download here: http://pastebin.com/RFFngh9g I take it chronologically as Pat is explaining them in the videos, so the next one will probably be NMR. These are the building blocks for the more advanced Ocean indis so even though these may not be the most useful directly I would have to program them anyway. tgt123: I will get to those as well. Grain Trader: not sure which ones you mean. In some of earlier posts I described what Ocean indis are in the TradeStation package I shared here. Danny, gbg, ahuramazdi and 6 others 9 Quote Link to comment Share on other sites More sharing options...
udc Posted April 5, 2012 Author Report Share Posted April 5, 2012 NMM for MT4 Now NMM itself. NMM is basically an average of Ocean Indexes with lookback from 1 to n, where n is NMM_period (40 by default). So for example NMM(5) would be: ( OceanIndex(1) + OceanIndex(2) + OceanIndex(3) + OceanIndex(4) + OceanIndex(5) ) / 5 Original NMM on TradeStation: http://img835.imageshack.us/img835/8959/nmmtradestation.png NMM on Metatrader: http://img820.imageshack.us/img820/5751/nmmmetatrader.png Original size screenshots: http://img833.imageshack.us/img833/8959/nmmtradestation.png http://img20.imageshack.us/img20/5751/nmmmetatrader.png #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Magenta #property indicator_color2 Silver #property indicator_level1 0 #property indicator_levelcolor Gray #property indicator_levelstyle 2 extern int NMM_period = 40; extern bool Show_SD = true; extern int SD_len = 30; extern double SD_up = 2; extern double SD_dn = 2; double NMM[]; double SD[]; int init() { string nmmname = "NMM(" + NMM_period + ")"; string sdname = "NMM_SD(" + SD_len + ")"; IndicatorShortName(nmmname); IndicatorBuffers(2); SetIndexBuffer(0, NMM); SetIndexLabel(0, nmmname); SetIndexBuffer(1, SD); SetIndexLabel(1, sdname); return(0); } int start() { int limit, i, ii, counted_bars = IndicatorCounted(); if(Bars <= NMM_period) return(0); if(counted_bars < 0) counted_bars = 0; if(counted_bars > NMM_period) limit = Bars - counted_bars; else limit = Bars - NMM_period - 1; for(i = limit; i >= 0; i--) { double nmm2 = 0; for(ii = 1; ii <= NMM_period; ii++) nmm2 += (MathLog(Close[i]) - MathLog(Close[i+ii])) / MathSqrt(ii); NMM[i] = (nmm2 / NMM_period) * 1000; } if(Show_SD) for(i = limit; i >= 0; i--) if(i < Bars - NMM_period - 1 - SD_len) { if(NMM[i] == 0) SD[i] = 0; else if(NMM[i] > 0) SD[i] = iBandsOnArray(NMM, 0, SD_len, SD_up, 0, MODE_UPPER, i); else if(NMM[i] < 0) SD[i] = iBandsOnArray(NMM, 0, SD_len, SD_dn, 0, MODE_LOWER, i); } return(0); } The source code is also available for download here: http://pastebin.com/K86AJkEE For now I am showing the Ocean indis on the same chart for reference. taipan, C0UNDE, monstar and 7 others 10 Quote Link to comment Share on other sites More sharing options...
udc Posted April 5, 2012 Author Report Share Posted April 5, 2012 NMR for MT4 NMR, a.k.a. natural market river. There is a funny moment in the video where Pat first says "we are dividing...", camera cut and the next moment he is saying "we are actually multiplying rather than dividing..." :) Those people sitting in the seminar must have had fun. Original NMR on TradeStation: http://img818.imageshack.us/img818/8089/nmrtradestation.png NMR on Metatrader: http://img812.imageshack.us/img812/4879/nmrmetatrader.png Original size screenshots: http://img196.imageshack.us/img196/8089/nmrtradestation.png http://img820.imageshack.us/img820/4879/nmrmetatrader.png #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Magenta #property indicator_color2 Silver #property indicator_level1 0 #property indicator_levelcolor Gray #property indicator_levelstyle 2 extern int NMR_period = 40; extern bool Show_SD = true; extern int SD_len = 30; extern double SD_up = 2; extern double SD_dn = 2; double NMR[]; double SD[]; int init() { string nmrname = "NMR(" + NMR_period + ")"; string sdname = "NMR_SD(" + SD_len + ")"; IndicatorShortName(nmrname); IndicatorBuffers(2); SetIndexBuffer(0, NMR); SetIndexLabel(0, nmrname); SetIndexBuffer(1, SD); SetIndexLabel(1, sdname); return(0); } int start() { int limit, i, ii, counted_bars = IndicatorCounted(); if(Bars <= NMR_period) return(0); if(counted_bars < 0) counted_bars = 0; if(counted_bars > NMR_period) limit = Bars - counted_bars; else limit = Bars - NMR_period - 1; for(i = limit; i >= 0; i--) { double nmr2 = 0; for(ii = 1; ii <= NMR_period; ii++) nmr2 += (MathLog(Close[i+ii-1]) - MathLog(Close[i+ii])) * (MathSqrt(ii) - MathSqrt(ii-1)); NMR[i] = nmr2 * 1000; } if(Show_SD) for(i = limit; i >= 0; i--) if(i < Bars - NMR_period - 1 - SD_len) { if(NMR[i] == 0) SD[i] = 0; else if(NMR[i] > 0) SD[i] = iBandsOnArray(NMR, 0, SD_len, SD_up, 0, MODE_UPPER, i); else if(NMR[i] < 0) SD[i] = iBandsOnArray(NMR, 0, SD_len, SD_dn, 0, MODE_LOWER, i); } return(0); } The source code is also available for download here: http://pastebin.com/di3N3W6Z Danny, for-ex, monstar and 7 others 10 Quote Link to comment Share on other sites More sharing options...
udc Posted April 5, 2012 Author Report Share Posted April 5, 2012 Fast NMA for MT4 Fast NMA. On the screenshots the regular NMA is yellow/gray dotted line, fast NMA is light/dark blue solid line. This one seems to me quite very useful for short-term support/resistance. Original Fast NMA on TradeStation: http://img210.imageshack.us/img210/4584/fastnmatradestation.png Fast NMA on Metatrader: http://img829.imageshack.us/img829/2144/fastnmametatrader.png Original size screenshots: http://img821.imageshack.us/img821/4584/fastnmatradestation.png http://img3.imageshack.us/img3/2144/fastnmametatrader.png #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Aqua #property indicator_color2 Blue #property indicator_color3 Blue extern int NMA_period = 40; extern int NMA_LB_min = 8; extern bool Show_SD = true; extern int SD_len = 20; extern double SD_up = 1.5; extern double SD_dn = 1.5; double NMA[]; double SDup[]; double SDdn[]; int init() { string nmaname = "Fast_NMA(" + NMA_period + ", " + NMA_LB_min + ")"; string sdname = "Fast_NMA_SD(" + SD_len + ")"; IndicatorShortName(nmaname); IndicatorBuffers(3); SetIndexBuffer(0, NMA); SetIndexLabel(0, nmaname); SetIndexBuffer(1, SDup); SetIndexLabel(1, sdname+"_up"); SetIndexBuffer(2, SDdn); SetIndexLabel(2, sdname+"_dn"); return(0); } int start() { int limit, i, ii, counted_bars = IndicatorCounted(); if(Bars <= MathMax(NMA_period, SD_len)) return(0); if(counted_bars < 0) counted_bars = 0; if(counted_bars > MathMax(NMA_period, SD_len)) limit = Bars - counted_bars; else limit = Bars - MathMax(NMA_period, SD_len) - 1; for(i = limit; i >= 0; i--) { double nmmnum, maxnmm = 0, sum, abssum, ratio = 0; int NMA_LB_max; for(ii = 1; ii <= NMA_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 < NMA_LB_min) NMA_LB_max = NMA_LB_min; sum = (MathLog(Close[i]) - MathLog(Close[i+1])) + (MathLog(Close[i+1]) - MathLog(Close[i+2])) * (MathSqrt(2)-1); for(ii = 2; ii < NMA_LB_max; ii++) sum += (MathLog(Close[i+ii]) - MathLog(Close[i+ii+1])) * (MathSqrt(ii+1) - MathSqrt(ii)); abssum = MathAbs(sum); sum = 0; for(ii = 0; ii < NMA_LB_max; ii++) sum += MathAbs(MathLog(Close[i+ii]) - MathLog(Close[i+ii+1])); if(sum != 0) ratio = abssum / sum; NMA[i] = NMA[i+1] + (Close[i] - NMA[i+1]) * ratio; if(Show_SD) { SDup[i] = NMA[i] + SD_up * iStdDev(Symbol(), Period(), SD_len, 0, 0, PRICE_CLOSE, i); SDdn[i] = NMA[i] - SD_dn * iStdDev(Symbol(), Period(), SD_len, 0, 0, PRICE_CLOSE, i); } } return(0); } The source code is also available for download here: http://pastebin.com/1m9EavNT gbg, monstar, Danny and 7 others 10 Quote Link to comment Share on other sites More sharing options...
udc Posted April 6, 2012 Author Report Share Posted April 6, 2012 NMM_X-Ray_1 for MT4 NMM_X-Ray_1. The scale of this indicator is from 0 to 40 with a dotted auxiliary middle line at 20. The number 40 is hardwired in the original TradeStation's version, I made it changeable via external variable called "NMM_period". You have no real reason to change it but if you do then you should also change the scale and the middle line appropriately. Also, there is a switch Show_Pct, turned off by default, to show values in percentage (what was 0 - 40 would be 0 - 100). If you use that switch you should respectively adjust the scale and the middle line. The TradeStation's version shows only the PosCnt value (the chart line). I show all 3 values (PosCnt, NegCnt and ZeroCnt) where the two others have by default no color assigned (thus are not visible). You can assign them a color, or, you can check their values via "Data Window". All three most recent values are also always shown in the upper left corner of the indicator chart window. Original NMM_X-Ray_1 on TradeStation: http://img341.imageshack.us/img341/7481/nmmxray1tradestation.png NMM_X-Ray_1 on Metatrader: http://img10.imageshack.us/img10/6563/nmmxray1metatrader.png Original size screenshots: http://img829.imageshack.us/img829/7481/nmmxray1tradestation.png http://img849.imageshack.us/img849/6563/nmmxray1metatrader.png #property indicator_separate_window #property indicator_minimum 0 #property indicator_maximum 40 #property indicator_buffers 3 #property indicator_color1 Yellow #property indicator_color2 CLR_NONE #property indicator_color3 CLR_NONE #property indicator_level1 20 #property indicator_levelcolor Gray #property indicator_levelstyle 2 extern int NMM_period = 40; extern bool Show_Pct = false; double NMM[]; double NegCnt[]; double ZeroCnt[]; int init() { string nmmname = "NMM_X-Ray_1"; IndicatorShortName(nmmname + "(" + NMM_period + ")"); IndicatorBuffers(3); SetIndexBuffer(0, NMM); SetIndexLabel(0, nmmname + "(" + NMM_period + ")"); SetIndexBuffer(1, NegCnt); SetIndexLabel(1, nmmname + "_NegCnt"); SetIndexBuffer(2, ZeroCnt); SetIndexLabel(2, nmmname + "_ZeroCnt"); return(0); } int start() { int limit, i, ii, counted_bars = IndicatorCounted(); if(Bars <= NMM_period) return(0); if(counted_bars < 0) counted_bars = 0; if(counted_bars > NMM_period) limit = Bars - counted_bars; else limit = Bars - NMM_period - 1; for(i = limit; i >= 0; i--) { double nmmnum, Pos = 0, Neg = 0, Zero = 0; for(ii = 1; ii <= NMM_period; ii++) { nmmnum = (MathLog(Close[i]) - MathLog(Close[i+ii])) / MathSqrt(ii); if(nmmnum > 0) Pos++; else if(nmmnum < 0) Neg++; else Zero++; } if(Show_Pct) { NMM[i] = Pos / NMM_period * 100; NegCnt[i] = Neg / NMM_period * 100; ZeroCnt[i] = Zero / NMM_period * 100; } else { NMM[i] = Pos; NegCnt[i] = Neg; ZeroCnt[i] = Zero; } } return(0); } The source code is also available for download here: http://pastebin.com/40qiAPLD Alex-622, C0UNDE, for-ex and 6 others 9 Quote Link to comment Share on other sites More sharing options...
udc Posted April 6, 2012 Author Report Share Posted April 6, 2012 NMM_X-Ray_2 for MT4 NMM_X-Ray_2. There are two modes (switches) - "Show_value" and "Show_LB". They can be switched on both at the same time, although it's not recommended as they have different scales. In the "Show_LB" mode the scale is from 0 to 40 (no percentage option) and the same remark regarding the consequences of changing the "NMM_period" variable applies as with NMM_X-Ray_1. In the "Show_value" mode the chart's fixed minimum and maximum should be deactivated. I added zero dotted line to make the sign line (red) better recognizable. Original NMM_X-Ray_2 on TradeStation: http://img600.imageshack.us/img600/8945/nmmxray2tradestation.png NMM_X-Ray_2 on Metatrader: http://img836.imageshack.us/img836/374/nmmxray2metatrader.png Original size screenshots: http://img841.imageshack.us/img841/8945/nmmxray2tradestation.png http://img209.imageshack.us/img209/374/nmmxray2metatrader.png #property indicator_separate_window #property indicator_minimum 0 #property indicator_maximum 40 #property indicator_buffers 3 #property indicator_color1 Red #property indicator_color2 Blue #property indicator_color3 Aqua #property indicator_level1 0 #property indicator_level2 20 #property indicator_levelcolor Gray #property indicator_levelstyle 2 extern int NMM_period = 40; extern bool Show_value = false; extern bool Show_LB = true; double NMMmaxratio[]; double NMMsign[]; double LBlen[]; int init() { string nmmname = "NMM_X-Ray_2"; IndicatorShortName(nmmname + "(" + NMM_period + ")"); if(Show_value) IndicatorDigits(2); else IndicatorDigits(0); IndicatorBuffers(3); SetIndexBuffer(0, NMMmaxratio); SetIndexLabel(0, nmmname + "(" + NMM_period + ")"); SetIndexBuffer(1, NMMsign); SetIndexLabel(1, nmmname + "_sign"); SetIndexBuffer(2, LBlen); SetIndexLabel(2, nmmname + "_LBlen"); return(0); } int start() { int limit, i, ii, counted_bars = IndicatorCounted(); if(Bars <= NMM_period) return(0); if(counted_bars < 0) counted_bars = 0; if(counted_bars > NMM_period) limit = Bars - counted_bars; else limit = Bars - NMM_period - 1; for(i = limit; i >= 0; i--) { double nmmnum, nmmmax = -1, nmmsign, nmmlb; for(ii = 1; ii <= NMM_period; ii++) { nmmnum = (MathLog(Close[i]) - MathLog(Close[i+ii])) / MathSqrt(ii); if(MathAbs(nmmnum) > nmmmax) { nmmmax = MathAbs(nmmnum); nmmlb = ii; if(nmmnum > 0) nmmsign = 1; else if(nmmnum < 0) nmmsign = -1; else nmmsign = 0; } } if(Show_value) { NMMmaxratio[i] = nmmmax * 1000; NMMsign[i] = nmmsign; } if(Show_LB) LBlen[i] = nmmlb; } return(0); } The source code is also available for download here: http://pastebin.com/4Sxez78d mashki, tradershare, C0UNDE and 7 others 10 Quote Link to comment Share on other sites More sharing options...
udc Posted April 6, 2012 Author Report Share Posted April 6, 2012 (edited) NMA_SD_Band_Width for MT4 NMA_SD_Band_Width. Though fully faithful to the original TradeStation source code, this one shouldn't be called NMA_anything as it has basically nothing to do with NMA. Pat probably didn't realize that he calculates the SD bands from the price, not from the NMA, and thus the difference between the upper and lower band is mere a sum of both deviation constants: SDup = NMA + SD_up * StdDev SDdn = NMA - SD_dn * StdDev SDwidth = SDup - SDdn = NMA + SD_up * StdDev - (NMA - SD_dn * StdDev) = NMA - NMA + SD_up * StdDev + SD_dn * StdDev = (SD_up + SD_dn) * iStdDev EDIT: Pat actually said on the video that what this indicator does is measuring the volatility. I guess he just named it NMA_... for convenience. It's a simple idea but definitely not unuseful. Original NMA_SD_Band_Width on TradeStation: http://img339.imageshack.us/img339/3770/nmasdbandwidthtradestat.png NMA_SD_Band_Width on Metatrader: http://img190.imageshack.us/img190/8113/nmasdbandwidthmetatrade.png Original size screenshots: http://img853.imageshack.us/img853/3770/nmasdbandwidthtradestat.png http://img189.imageshack.us/img189/8113/nmasdbandwidthmetatrade.png #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Blue extern int NMA_period = 40; extern bool FastNMA = true; extern int NMA_LB_min = 8; extern int SD_len = 20; extern double SD_up = 1.5; extern double SD_dn = 1.5; extern bool Show_Pct = false; double SD_Band_Width[]; double NMA[]; double SDup[]; double SDdn[]; int init() { string nmaname = "NMA_SD_Band_Width(" + NMA_period + ")"; if(FastNMA) nmaname = "Fast_NMA_SD_Band_Width(" + NMA_period + ", " + NMA_LB_min + ")"; IndicatorShortName(nmaname); IndicatorBuffers(4); SetIndexBuffer(0, SD_Band_Width); SetIndexLabel(0, nmaname); SetIndexBuffer(1, NMA); SetIndexBuffer(2, SDup); SetIndexBuffer(3, SDdn); return(0); } int start() { int limit, i, ii, counted_bars = IndicatorCounted(); if(Bars <= MathMax(NMA_period, SD_len)) return(0); if(counted_bars < 0) counted_bars = 0; if(counted_bars > MathMax(NMA_period, SD_len)) limit = Bars - counted_bars; else limit = Bars - MathMax(NMA_period, SD_len) - 1; for(i = limit; i >= 0; i--) { double nmmnum, maxnmm = 0, sum, abssum, ratio = 0; int NMA_LB_max; if(FastNMA) { for(ii = 1; ii <= NMA_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 < NMA_LB_min) NMA_LB_max = NMA_LB_min; } else NMA_LB_max = NMA_period; sum = (MathLog(Close[i]) - MathLog(Close[i+1])) + (MathLog(Close[i+1]) - MathLog(Close[i+2])) * (MathSqrt(2)-1); for(ii = 2; ii < NMA_LB_max; ii++) sum += (MathLog(Close[i+ii]) - MathLog(Close[i+ii+1])) * (MathSqrt(ii+1) - MathSqrt(ii)); abssum = MathAbs(sum); sum = 0; for(ii = 0; ii < NMA_LB_max; ii++) sum += MathAbs(MathLog(Close[i+ii]) - MathLog(Close[i+ii+1])); if(sum != 0) ratio = abssum / sum; NMA[i] = NMA[i+1] + (Close[i] - NMA[i+1]) * ratio; SDup[i] = NMA[i] + SD_up * iStdDev(NULL, 0, SD_len, 0, 0, PRICE_CLOSE, i); SDdn[i] = NMA[i] - SD_dn * iStdDev(NULL, 0, SD_len, 0, 0, PRICE_CLOSE, i); if(Show_Pct) SD_Band_Width[i] = (SDup[i] - SDdn[i]) / NMA[i] * 100; else SD_Band_Width[i] = SDup[i] - SDdn[i]; } return(0); } The source code is also available for download here: http://pastebin.com/Bq4yHqAB Edited April 6, 2012 by udc Alex-622, ahuramazdi, mashki and 5 others 8 Quote Link to comment Share on other sites More sharing options...
udc Posted April 6, 2012 Author Report Share Posted April 6, 2012 NMA_SD_Band_Osc for MT4 NMA_SD_Band_Osc. Original NMA_SD_Band_Osc on TradeStation: http://img13.imageshack.us/img13/7295/nmasdbandosctradestatio.png NMA_SD_Band_Osc on Metatrader: http://img836.imageshack.us/img836/6674/nmasdbandoscmetatrader.png Original size screenshots: http://img526.imageshack.us/img526/7295/nmasdbandosctradestatio.png http://img401.imageshack.us/img401/6674/nmasdbandoscmetatrader.png #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Red #property indicator_level1 0 #property indicator_level2 50 #property indicator_level3 100 #property indicator_levelcolor Gray #property indicator_levelstyle 2 extern int NMA_period = 40; extern bool FastNMA = true; extern int NMA_LB_min = 8; extern int SD_len = 20; extern double SD_up = 1.5; extern double SD_dn = 1.5; double SD_Band_Osc[]; double NMA[]; double SDup[]; double SDdn[]; int init() { string nmaname = "NMA_SD_Band_Osc(" + NMA_period + ")"; if(FastNMA) nmaname = "Fast_NMA_SD_Band_Osc(" + NMA_period + ", " + NMA_LB_min + ")"; IndicatorShortName(nmaname); IndicatorBuffers(4); SetIndexBuffer(0, SD_Band_Osc); SetIndexLabel(0, nmaname); SetIndexBuffer(1, NMA); SetIndexBuffer(2, SDup); SetIndexBuffer(3, SDdn); return(0); } int start() { int limit, i, ii, counted_bars = IndicatorCounted(); if(Bars <= MathMax(NMA_period, SD_len)) return(0); if(counted_bars < 0) counted_bars = 0; if(counted_bars > MathMax(NMA_period, SD_len)) limit = Bars - counted_bars; else limit = Bars - MathMax(NMA_period, SD_len) - 1; for(i = limit; i >= 0; i--) { double nmmnum, maxnmm = 0, sum, abssum, ratio = 0; int NMA_LB_max; if(FastNMA) { for(ii = 1; ii <= NMA_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 < NMA_LB_min) NMA_LB_max = NMA_LB_min; } else NMA_LB_max = NMA_period; sum = (MathLog(Close[i]) - MathLog(Close[i+1])) + (MathLog(Close[i+1]) - MathLog(Close[i+2])) * (MathSqrt(2)-1); for(ii = 2; ii < NMA_LB_max; ii++) sum += (MathLog(Close[i+ii]) - MathLog(Close[i+ii+1])) * (MathSqrt(ii+1) - MathSqrt(ii)); abssum = MathAbs(sum); sum = 0; for(ii = 0; ii < NMA_LB_max; ii++) sum += MathAbs(MathLog(Close[i+ii]) - MathLog(Close[i+ii+1])); if(sum != 0) ratio = abssum / sum; NMA[i] = NMA[i+1] + (Close[i] - NMA[i+1]) * ratio; SDup[i] = NMA[i] + SD_up * iStdDev(NULL, 0, SD_len, 0, 0, PRICE_CLOSE, i); SDdn[i] = NMA[i] - SD_dn * iStdDev(NULL, 0, SD_len, 0, 0, PRICE_CLOSE, i); SD_Band_Osc[i] = (Close[i] - SDdn[i]) / (SDup[i] - SDdn[i]) * 100; } return(0); } The source code is also available for download here: http://pastebin.com/aC6C7ZDH monstar, toddanderson, Danny and 7 others 10 Quote Link to comment Share on other sites More sharing options...
udc Posted April 6, 2012 Author Report Share Posted April 6, 2012 NMA_Price_Osc for MT4 NMA_Price_Osc. This indi shows the distance between the price and NMA in the form of an oscilator. The TradeStation's original version can do that only for the regular NMA. My Metatrader version can do that also for the Fast NMA. Original NMA_Price_Osc on TradeStation: http://img252.imageshack.us/img252/4949/nmapriceosctradestation.png NMA_Price_Osc on Metatrader: http://img851.imageshack.us/img851/8864/nmapriceoscmetatrader.png Original size screenshots: http://img39.imageshack.us/img39/4949/nmapriceosctradestation.png http://img560.imageshack.us/img560/8864/nmapriceoscmetatrader.png #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Magenta #property indicator_color2 Silver #property indicator_level1 0 #property indicator_levelcolor Gray #property indicator_levelstyle 2 extern int NMA_period = 40; extern bool FastNMA = true; extern int NMA_LB_min = 8; extern bool Show_SD = true; extern int SD_len = 30; extern double SD_up = 2; extern double SD_dn = 2; double Price_Osc[]; double SD[]; double NMA[]; int init() { string nmaname = "NMA_Price_Osc(" + NMA_period + ")"; if(FastNMA) nmaname = "Fast_NMA_Price_Osc(" + NMA_period + ", " + NMA_LB_min + ")"; string sdname = "NMA_Price_Osc_SD(" + SD_len + ")"; IndicatorShortName(nmaname); IndicatorBuffers(3); SetIndexBuffer(0, Price_Osc); SetIndexLabel(0, nmaname); SetIndexBuffer(1, SD); SetIndexLabel(1, sdname); SetIndexBuffer(2, NMA); return(0); } int start() { int limit, i, ii, counted_bars = IndicatorCounted(); if(Bars <= NMA_period) return(0); if(counted_bars < 0) counted_bars = 0; if(counted_bars > NMA_period) limit = Bars - counted_bars; else limit = Bars - NMA_period - 1; for(i = limit; i >= 0; i--) { double nmmnum, maxnmm = 0, sum, abssum, ratio = 0; int NMA_LB_max; if(FastNMA) { for(ii = 1; ii <= NMA_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 < NMA_LB_min) NMA_LB_max = NMA_LB_min; } else NMA_LB_max = NMA_period; sum = (MathLog(Close[i]) - MathLog(Close[i+1])) + (MathLog(Close[i+1]) - MathLog(Close[i+2])) * (MathSqrt(2)-1); for(ii = 2; ii < NMA_LB_max; ii++) sum += (MathLog(Close[i+ii]) - MathLog(Close[i+ii+1])) * (MathSqrt(ii+1) - MathSqrt(ii)); abssum = MathAbs(sum); sum = 0; for(ii = 0; ii < NMA_LB_max; ii++) sum += MathAbs(MathLog(Close[i+ii]) - MathLog(Close[i+ii+1])); if(sum != 0) ratio = abssum / sum; NMA[i] = NMA[i+1] + (Close[i] - NMA[i+1]) * ratio; Price_Osc[i] = Close[i] - NMA[i]; } if(Show_SD) for(i = limit; i >= 0; i--) if(i < Bars - NMA_period - 1 - SD_len) { if(Price_Osc[i] == 0) SD[i] = 0; else if(Price_Osc[i] > 0) SD[i] = iBandsOnArray(Price_Osc, 0, SD_len, SD_up, 0, MODE_UPPER, i); else if(Price_Osc[i] < 0) SD[i] = iBandsOnArray(Price_Osc, 0, SD_len, SD_dn, 0, MODE_LOWER, i); } return(0); } The source code is also available for download here: http://pastebin.com/htivEk8D tgt123, craven, ahuramazdi and 6 others 9 Quote Link to comment Share on other sites More sharing options...
tgt123 Posted April 6, 2012 Report Share Posted April 6, 2012 Next one is the NMM Ocean Index. A slight discrepancy (i.e. a missing SD band's zero cross from below on 3/29) is due to the differences in price feeds, the math is correct. Original NMM Ocean Index on TradeStation: http://img195.imageshack.us/img195/7533/oceanindextradestation.png NMM Ocean Index on Metatrader: http://img853.imageshack.us/img853/438/oceanindexmetatrader.png Original size screenshots: http://img651.imageshack.us/img651/7533/oceanindextradestation.png http://img40.imageshack.us/img40/438/oceanindexmetatrader.png #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Magenta #property indicator_color2 Silver #property indicator_level1 0 #property indicator_levelcolor Gray #property indicator_levelstyle 2 extern int NMM_LB = 21; extern bool Show_SD = true; extern int SD_len = 30; extern double SD_up = 2; extern double SD_dn = 2; double NMM[]; double SD[]; int init() { string nmmname = "NMM_Ocean_Index(" + NMM_LB + ")"; string sdname = "NMM_Ocean_Index_SD(" + SD_len + ")"; IndicatorShortName(nmmname); IndicatorBuffers(2); SetIndexBuffer(0, NMM); SetIndexLabel(0, nmmname); SetIndexBuffer(1, SD); SetIndexLabel(1, sdname); return(0); } int start() { int limit, i, counted_bars = IndicatorCounted(); if(Bars <= NMM_LB) return(0); if(counted_bars < 0) counted_bars = 0; if(counted_bars > NMM_LB) limit = Bars - counted_bars; else limit = Bars - NMM_LB - 1; for(i = limit; i >= 0; i--) NMM[i] = (MathLog(Close[i]) - MathLog(Close[i+NMM_LB])) / MathSqrt(NMM_LB) * 1000; if(Show_SD) for(i = limit; i >= 0; i--) if(i < Bars - NMM_LB - 1 - SD_len) { if(NMM[i] == 0) SD[i] = 0; else if(NMM[i] > 0) SD[i] = iBandsOnArray(NMM, 0, SD_len, SD_up, 0, MODE_UPPER, i); else if(NMM[i] < 0) SD[i] = iBandsOnArray(NMM, 0, SD_len, SD_dn, 0, MODE_LOWER, i); } return(0); } The source code is also available for download here: http://pastebin.com/RFFngh9g I take it chronologically as Pat is explaining them in the videos, so the next one will probably be NMR. These are the building blocks for the more advanced Ocean indis so even though these may not be the most useful directly I would have to program them anyway. tgt123: I will get to those as well. Grain Trader: not sure which ones you mean. In some of earlier posts I described what Ocean indis are in the TradeStation package I shared here. Very Great udc. Thanks again Alex-622 and monstar 2 Quote Link to comment Share on other sites More sharing options...
udc Posted April 6, 2012 Author Report Share Posted April 6, 2012 NMM_with_Ocn_MAs for MT4 NMM_with_Ocn_MAs. This one is the NMM indi as before, but instead of showing SD bands there are NMA and FastNMA applied onto NMM. The reason why FastNMA of NMM is different in my implementation is because there is a mistake in the original TradeStation version. When Pat was modifying the FastNMA code to take NMM as an input (instead of the price) he forgot to change the input for lookback calculation so he is still calculating the lookback from the price. For those interested in TradeStation version, the following change needs to be done in the $NMM_with Ocn MAs study: (wrong) Value1 = _Ocn.NMM.Fn (Price, SC, 1, 1) ; Value2 = _Ocn.MA.Fn (FALSE, Value1, 1) ; Value3 = _Ocn.FastMA.Fn (FALSE, Value1, [b][u]CLOSE[/u][/b], SC, 1, 1, LB.Min) ; (correct) Value1 = _Ocn.NMM.Fn (Price, SC, 1, 1) ; Value2 = _Ocn.MA.Fn (FALSE, Value1, 1) ; Value3 = _Ocn.FastMA.Fn (FALSE, Value1, [b][u]Value1[/u][/b], SC, 1, 1, LB.Min) ; Original NMM_with_Ocn_MAs on TradeStation: http://img827.imageshack.us/img827/3440/nmmwithocnmastradestati.png NMM_with_Ocn_MAs on Metatrader: http://img6.imageshack.us/img6/3783/nmmwithocnmasmetatrader.png Original size screenshots: http://img542.imageshack.us/img542/3440/nmmwithocnmastradestati.png http://img820.imageshack.us/img820/3783/nmmwithocnmasmetatrader.png #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 Magenta #property indicator_color2 Yellow #property indicator_color3 Aqua #property indicator_level1 0 #property indicator_levelcolor Gray #property indicator_levelstyle 2 extern int NMM_period = 40; extern int NMA_period = 40; extern int NMA_LB_min = 8; double NMM[]; double NMM_NMA[]; double NMM_FastNMA[]; int init() { IndicatorShortName("NMM_with_Ocn_MAs(" + NMM_period + ", " + NMA_period + ", " + NMA_LB_min + ")"); IndicatorBuffers(3); SetIndexBuffer(0, NMM); SetIndexLabel(0, "NMM(" + NMM_period + ")"); SetIndexBuffer(1, NMM_NMA); SetIndexLabel(1, "NMM_NMA(" + NMA_period + ")"); SetIndexBuffer(2, NMM_FastNMA); SetIndexLabel(2, "NMM_FastNMA(" + NMA_period + ", " + NMA_LB_min + ")"); return(0); } int start() { int limit, i, ii, counted_bars = IndicatorCounted(); double nmm2, sum, abssum, ratio, nmmnum, maxnmm; if(Bars <= NMM_period) return(0); if(counted_bars < 0) counted_bars = 0; if(counted_bars > NMM_period) limit = Bars - counted_bars; else limit = Bars - NMM_period - 1; for(i = limit; i >= 0; i--) { nmm2 = 0; for(ii = 1; ii <= NMM_period; ii++) nmm2 += (MathLog(Close[i]) - MathLog(Close[i+ii])) / MathSqrt(ii); NMM[i] = (nmm2 / NMM_period) * 1000; } for(i = limit; i >= 0; i--) if(i < Bars - NMM_period - 1 - NMA_period) { ratio = 0; sum = (NMM[i] - NMM[i+1]) + (NMM[i+1] - NMM[i+2]) * (MathSqrt(2)-1); for(ii = 2; ii < NMA_period; ii++) sum += (NMM[i+ii] - NMM[i+ii+1]) * (MathSqrt(ii+1) - MathSqrt(ii)); abssum = MathAbs(sum); sum = 0; for(ii = 0; ii < NMA_period; ii++) sum += MathAbs(NMM[i+ii] - NMM[i+ii+1]); if(sum != 0) ratio = abssum / sum; NMM_NMA[i] = NMM_NMA[i+1] + (NMM[i] - NMM_NMA[i+1]) * ratio; } for(i = limit; i >= 0; i--) if(i < Bars - NMM_period - 1 - NMA_period) { maxnmm = 0; ratio = 0; int NMA_LB_max; for(ii = 1; ii <= NMA_period; ii++) { nmmnum = (NMM[i] - NMM[i+ii]) / MathSqrt(ii); if(MathAbs(nmmnum) > maxnmm) { maxnmm = MathAbs(nmmnum); NMA_LB_max = ii; } } if(NMA_LB_max < NMA_LB_min) NMA_LB_max = NMA_LB_min; sum = (NMM[i] - NMM[i+1]) + (NMM[i+1] - NMM[i+2]) * (MathSqrt(2)-1); for(ii = 2; ii < NMA_LB_max; ii++) sum += (NMM[i+ii] - NMM[i+ii+1]) * (MathSqrt(ii+1) - MathSqrt(ii)); abssum = MathAbs(sum); sum = 0; for(ii = 0; ii < NMA_LB_max; ii++) sum += MathAbs(NMM[i+ii] - NMM[i+ii+1]); if(sum != 0) ratio = abssum / sum; NMM_FastNMA[i] = NMM_FastNMA[i+1] + (NMM[i] - NMM_FastNMA[i+1]) * ratio; } return(0); } The source code is also available for download here: http://pastebin.com/Dp9ErqUf tgt123: you are welcome. ahuramazdi, crodzilla, monstar and 3 others 6 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.