Author: Copyright 2012, Melniciuc Alexei
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
vOksn_1_1
//+------------------------------------------------------------------+
//|                                                      !Oksn.mq4 |
//|                                 Copyright 2012, Melniciuc Alexei |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, Melniciuc Alexei"
#property link      "miller.bird0@gmail.com"

#property indicator_separate_window
#property indicator_minimum   0
#property indicator_maximum   100
#property indicator_buffers   5
#property indicator_color1    Blue
#property indicator_color2    Red
#property indicator_color3    Green
#property indicator_level1    50

#define GRIDSTART   50
#define GRIDEND     500
#define STEP        50
#define N           6   //12
#define EMTYVAL     -1
#define LIMIT       1500
#define TABELSIZE   562 //640 //40960

//--- buffers
double Oksn[];
double GridF[];
double Grid[];
double AllF[];
double All[];

//--- vars
bool visibel;
//double Tabel[((GRIDEND-GRIDSTART)/STEP+1)*MathPow(2,N),5];
double Tabel[TABELSIZE,5]={
50,0,55.36459082,5.36459082,55624
,50,1,52.03994446,2.03994446,18726
,50,2,53.54353486,3.54353486,3457
,50,3,51.00694444,1.00694444,11520
,50,4,48.58115778,1.41884222,1762
,50,5,43.17817014,6.82182986,623
,50,6,50.22194039,0.22194039,3154
,50,7,49.88974063,0.11025937,9523
,50,8,46.65936473,3.34063527,913
,50,9,37.54789272,12.45210728,261
,50,10,28.84615385,21.15384615,52
,50,11,32.45283019,17.54716981,265
,50,12,47.09090909,2.90909091,1100
,50,13,56.36856369,6.36856369,369
,50,14,44.36416185,5.63583815,2076
,50,15,45.53202823,4.46797177,7509
,50,16,59.3495935,9.3495935,738
,50,17,64.95726496,14.95726496,234
,50,18,15.49295775,34.50704225,71
,50,19,53.84615385,3.84615385,208
,50,20,61.53846154,11.53846154,13
,50,21,100,50,5
,50,22,71.18644068,21.18644068,59
,50,23,47.85714286,2.14285714,140
,50,24,41.42678348,8.57321652,799
,50,25,49.14285714,0.85714286,175
,50,26,43.75,6.25,48
,50,27,52.33160622,2.33160622,193
,50,28,46.70380687,3.29619313,1077
,50,29,57.43944637,7.43944637,289
,50,30,50.4342791,0.4342791,1727
,50,31,46.99730094,3.00269906,5928
,50,32,48.64366119,1.35633881,5419
,50,33,47.05546026,2.94453974,1749
,50,34,40.13921114,9.86078886,431
,50,35,43.61799816,6.38200184,1089
,50,36,76.51515152,26.51515152,132
,50,37,55.35714286,5.35714286,56
,50,38,60.11904762,10.11904762,168
,50,39,50.14705882,0.14705882,680
,50,40,38.85869565,11.14130435,368
,50,41,51.2195122,1.2195122,41
,50,42,66.66666667,16.66666667,9
,50,43,70.73170732,20.73170732,41
,50,44,33.5106383,16.4893617,188
,50,45,56.75675676,6.75675676,37
,50,46,54.22885572,4.22885572,201
,50,47,54.57831325,4.57831325,830
,50,48,51.39767932,1.39767932,7584
,50,49,47.32900649,2.67099351,2003
,50,50,63.97306397,13.97306397,297
,50,51,48.88888889,1.11111111,1125
,50,52,50.4,0.4,125
,50,53,43.52941176,6.47058824,85
,50,54,58.70307167,8.70307167,293
,50,55,50.23299161,0.23299161,1073
,50,56,51.88172043,1.88172043,9300
,50,57,45.93317584,4.06682416,2963
,50,58,50,0,438
,50,59,45.27829894,4.72170106,1599
,50,60,48.26568925,1.73431075,11186
,50,61,47.03546099,2.96453901,3525
,50,62,44.83221477,5.16778523,17135
,50,63,45.49929401,4.50070599,50992
,100,0,52.48468889,2.48468889,50127
,100,1,50.3435518,0.3435518,18920
,100,2,45.16680924,4.83319076,3507
,100,3,48.70870871,1.29129129,13320
,100,4,56.09919571,6.09919571,1492
,100,5,52.97113752,2.97113752,589
,100,6,52.28525122,2.28525122,3085
,100,7,49.48968512,0.51031488,9210
,100,8,36.88888889,13.11111111,675
,100,9,56,6,300
,100,10,68.65671642,18.65671642,67
,100,11,26.72413793,23.27586207,116
,100,12,33.73718546,16.26281454,1073
,100,13,33.8028169,16.1971831,355
,100,14,50.42839657,0.42839657,2451
,100,15,50.5911188,0.5911188,6936
,100,16,61.82298547,11.82298547,757
,100,17,73.97959184,23.97959184,196
,100,18,81.57894737,31.57894737,38
,100,19,70.42253521,20.42253521,142
,100,20,10,40,20
,100,21,0,50,10
,100,22,9.75609756,40.24390244,82
,100,23,33.1797235,16.8202765,217
,100,24,62.88135593,12.88135593,590
,100,25,66.81415929,16.81415929,226
,100,26,84.61538462,34.61538462,39
,100,27,89.6039604,39.6039604,202
,100,28,43.43807763,6.56192237,1082
,100,29,37.76223776,12.23776224,286
,100,30,43.18959617,6.81040383,1461
,100,31,48.98785425,1.01214575,5434
,100,32,48.8671059,1.1328941,6223
,100,33,52.81526291,2.81526291,2149
,100,34,39.78494624,10.21505376,279
,100,35,48.29059829,1.70940171,936
,100,36,39.77272727,10.22727273,88
,100,37,59.75609756,9.75609756,82
,100,38,59.06040268,9.06040268,149
,100,39,51.32890365,1.32890365,602
,100,40,47.22222222,2.77777778,36
,100,41,50,0,26
,100,43,50,0,2
,100,44,45.45454545,4.54545455,33
,100,45,60,10,15
,100,46,36.04651163,13.95348837,86
,100,47,45.22417154,4.77582846,513
,100,48,47.13756424,2.86243576,8367
,100,49,42.29435865,7.70564135,3173
,100,50,44.64285714,5.35714286,392
,100,51,47.45519713,2.54480287,1395
,100,52,31.57894737,18.42105263,76
,100,53,71.05263158,21.05263158,38
,100,54,50.14836795,0.14836795,337
,100,55,51.11111111,1.11111111,675
,100,56,51.22311456,1.22311456,10833
,100,57,49.3807558,0.6192442,3149
,100,58,34.18290855,15.81709145,667
,100,59,38.42281879,11.57718121,1788
,100,60,48.17068646,1.82931354,13475
,100,61,52.69894268,2.69894268,3594
,100,62,44.40259153,5.59740847,19911
,100,63,47.93084615,2.06915385,47604
,150,0,48.4984066,1.5015934,47383
,150,1,47.15496368,2.84503632,21476
,150,2,56.48125459,6.48125459,4081
,150,3,49.26840598,0.73159402,12917
,150,4,48.64864865,1.35135135,1332
,150,5,77.19594595,27.19594595,592
,150,6,33.28391401,16.71608599,2698
,150,7,47.55550811,2.44449189,9368
,150,8,61.73410405,11.73410405,865
,150,9,59.9078341,9.9078341,217
,150,10,76.63551402,26.63551402,107
,150,11,62.26415094,12.26415094,212
,150,12,45.66308244,4.33691756,1395
,150,13,49.20634921,0.79365079,504
,150,14,50.62200957,0.62200957,2090
,150,15,52.92748433,2.92748433,5585
,150,16,53.88429752,3.88429752,605
,150,17,17.87234043,32.12765957,235
,150,18,44.73684211,5.26315789,38
,150,19,64.23357664,14.23357664,137
,150,20,45.18518519,4.81481481,135
,150,21,100,50,14
,150,22,73.07692308,23.07692308,26
,150,23,83.60655738,33.60655738,122
,150,24,47.80810587,2.19189413,1209
,150,25,75,25,200
,150,26,100,50,28
,150,27,48.8372093,1.1627907,86
,150,28,49.08180301,0.91819699,1797
,150,29,37.3549884,12.6450116,431
,150,30,52.94978059,2.94978059,2051
,150,31,51.91850594,1.91850594,5890
,150,32,48.46356453,1.53643547,5695
,150,33,63.07448494,13.07448494,1893
,150,34,76.9041769,26.9041769,407
,150,35,64.30801249,14.30801249,961
,150,36,84.1025641,34.1025641,195
,150,37,88.23529412,38.23529412,17
,150,38,26.59574468,23.40425532,188
,150,39,47.50656168,2.49343832,381
,150,40,0,50,4
,150,44,62,12,50
,150,45,37.5,12.5,32
,150,46,67.83216783,17.83216783,143
,150,47,38.88888889,11.11111111,360
,150,48,44.89453834,5.10546166,7159
,150,49,48.8761569,1.1238431,2269
,150,50,47.01754386,2.98245614,285
,150,51,63.45353675,13.45353675,1442
,150,52,32.96703297,17.03296703,91
,150,53,55,5,20
,150,54,73.41040462,23.41040462,173
,150,55,66.6163142,16.6163142,662
,150,56,44.42605394,5.57394606,10271
,150,57,35.88342441,14.11657559,3294
,150,58,41.6,8.4,250
,150,59,47.62633997,2.37366003,1306
,150,60,46.20013523,3.79986477,14790
,150,61,41.79307222,8.20692778,4417
,150,62,45.48224274,4.51775726,21991
,150,63,48.72585723,1.27414277,47012
,200,0,45.68409049,4.31590951,49109
,200,1,47.24214927,2.75785073,21049
,200,2,38.05040155,11.94959845,3611
,200,3,49.98871587,0.01128413,13293
,200,4,65.24163569,15.24163569,1614
,200,5,68.53281853,18.53281853,518
,200,6,49.35576235,0.64423765,2794
,200,7,51.44927536,1.44927536,8280
,200,8,21.44522145,28.55477855,429
,200,9,30.9352518,19.0647482,139
,200,10,100,50,9
,200,11,100,50,33
,200,12,32.57359924,17.42640076,2106
,200,13,60.10781671,10.10781671,371
,200,14,31.37747098,18.62252902,3187
,200,15,44.79435168,5.20564832,8923
,200,16,35.59322034,14.40677966,531
,200,17,68.11594203,18.11594203,69
,200,18,100,50,45
,200,19,100,50,46
,200,20,0,50,16
,200,23,100,50,34
,200,24,26.78571429,23.21428571,112
,200,25,3.84615385,46.15384615,78
,200,27,100,50,4
,200,28,12.09766926,37.90233074,901
,200,29,6.4516129,43.5483871,155
,200,30,26.67478685,23.32521315,1642
,200,31,33.80035026,16.19964974,5710
,200,32,51.83333333,1.83333333,4800
,200,33,51.29573171,1.29573171,2624
,200,34,23.17073171,26.82926829,82
,200,35,46.02368866,3.97631134,1182
,200,36,52.10918114,2.10918114,403
,200,37,23.52941176,26.47058824,51
,200,38,48.71794872,1.28205128,117
,200,39,56.88622754,6.88622754,334
,200,40,95.94594595,45.94594595,222
,200,41,28.81355932,21.18644068,59
,200,42,12.5,37.5,8
,200,43,74.50980392,24.50980392,51
,200,44,18.43575419,31.56424581,179
,200,46,40,10,65
,200,47,40.8719346,9.1280654,367
,200,48,56.79099226,6.79099226,7105
,200,49,57.08937763,7.08937763,2137
,200,50,41.08527132,8.91472868,387
,200,51,49.0990991,0.9009009,888
,200,52,50,0,48
,200,53,90,40,20
,200,54,39.7260274,10.2739726,219
,200,55,32.28476821,17.71523179,604
,200,56,40.15634643,9.84365357,9722
,200,57,53.73437954,3.73437954,3441
,200,58,68.87052342,18.87052342,363
,200,59,66.71608599,16.71608599,1349
,200,60,44.45547175,5.54452825,15114
,200,61,33.17744154,16.82255846,3635
,200,62,52.22527353,2.22527353,22941
,200,63,50.89708906,0.89708906,46205
,250,0,44.57198808,5.42801192,48001
,250,1,48.93096575,1.06903425,22076
,250,2,44.8085999,5.1914001,3814
,250,3,47.39466066,2.60533934,12436
,250,4,26.30121816,23.69878184,1806
,250,5,40,10,360
,250,6,35.33727328,14.66272672,4907
,250,7,47.50237417,2.49762583,10530
,250,8,48.7037037,1.2962963,540
,250,9,67.04545455,17.04545455,88
,250,10,0,50,24
,250,11,20,30,40
,250,12,14.28571429,35.71428571,168
,250,13,100,50,6
,250,14,18.36913634,31.63086366,2281
,250,15,33.82927562,16.17072438,6654
,250,16,66.35514019,16.35514019,107
,250,17,100,50,32
,250,24,50.8361204,0.8361204,598
,250,25,65.59485531,15.59485531,311
,250,27,100,50,31
,250,28,32.09590101,17.90409899,1293
,250,29,86.71096346,36.71096346,301
,250,30,69.15520629,19.15520629,1018
,250,31,52.50803859,2.50803859,3110
,250,32,45.37353053,4.62646947,5274
,250,33,64.89825581,14.89825581,1376
,250,34,45.58823529,4.41176471,272
,250,35,67.69230769,17.69230769,975
,250,36,97.61904762,47.61904762,42
,250,38,11.36363636,38.63636364,44
,250,39,62.28926353,12.28926353,1127
,250,40,2.34113712,47.65886288,299
,250,41,100,50,1
,250,42,100,50,11
,250,43,100,50,70
,250,44,14.0625,35.9375,64
,250,45,0,50,6
,250,46,100,50,40
,250,47,78.87700535,28.87700535,374
,250,48,53.33427923,3.33427923,7048
,250,49,50.81915564,0.81915564,3174
,250,50,39.51965066,10.48034934,458
,250,51,59.05598244,9.05598244,911
,250,52,50.64377682,0.64377682,233
,250,53,38.0952381,11.9047619,42
,250,54,38.50574713,11.49425287,348
,250,55,48.63123994,1.36876006,621
,250,56,58.43339693,8.43339693,8911
,250,57,60.38314176,10.38314176,2610
,250,58,62.14285714,12.14285714,560
,250,59,23.22515213,26.77484787,986
,250,60,37.46741666,12.53258334,14578
,250,61,42.40837696,7.59162304,4011
,250,62,48.95554154,1.04445846,25372
,250,63,48.42845495,1.57154505,49060
,300,0,44.71761591,5.28238409,50233
,300,1,46.61340276,3.38659724,22279
,300,2,45.92107953,4.07892047,4891
,300,3,48.07340907,1.92659093,12587
,300,4,56.90376569,6.90376569,239
,300,5,0,50,5
,300,6,19.81279251,30.18720749,3846
,300,7,36.70703576,13.29296424,10404
,300,8,75.22123894,25.22123894,226
,300,9,81.08108108,31.08108108,37
,300,10,0,50,3
,300,11,0,50,4
,300,12,47.46936601,2.53063399,1877
,300,13,63.86363636,13.86363636,440
,300,14,62.63603386,12.63603386,827
,300,15,48.90929966,1.09070034,4355
,300,16,38.51851852,11.48148148,1080
,300,17,100,50,267
,300,18,100,50,1
,300,19,100,50,13
,300,23,100,50,47
,300,24,55.63909774,5.63909774,1197
,300,25,85.18518519,35.18518519,432
,300,26,100,50,338
,300,27,100,50,148
,300,28,74.22389464,24.22389464,1063
,300,29,81.67539267,31.67539267,191
,300,30,29.28571429,20.71428571,1400
,300,31,50.62402496,0.62402496,2564
,300,32,54.43595089,4.43595089,4317
,300,33,77.36625514,27.36625514,1458
,300,34,33.65384615,16.34615385,312
,300,35,63.73182553,13.73182553,1238
,300,36,17.39130435,32.60869565,23
,300,37,100,50,12
,300,38,0,50,241
,300,39,58.3090379,8.3090379,343
,300,40,0,50,14
,300,44,5.45454545,44.54545455,110
,300,46,97.4025974,47.4025974,77
,300,47,82.08955224,32.08955224,134
,300,48,43.74127501,6.25872499,6447
,300,49,67.61177754,17.61177754,1834
,300,50,37.32394366,12.67605634,142
,300,51,49.56183057,0.43816943,1027
,300,52,63.38461538,13.38461538,325
,300,53,100,50,58
,300,54,100,50,117
,300,55,70.72490706,20.72490706,1076
,300,56,58.0426476,8.0426476,8113
,300,57,43.82314694,6.17685306,3076
,300,58,25.08417508,24.91582492,594
,300,59,35.84158416,14.15841584,1010
,300,60,46.97555637,3.02444363,13705
,300,61,51.38194262,1.38194262,3799
,300,62,48.277415,1.722585,26646
,300,63,45.92198922,4.07801078,52121
,350,0,47.22569135,2.77430865,50445
,350,1,44.15235803,5.84764197,21607
,350,2,38.28581244,11.71418756,5822
,350,3,36.51305392,13.48694608,15819
,350,4,38.944495,11.055505,1099
,350,5,42.19409283,7.80590717,237
,350,6,24.81139983,25.18860017,1193
,350,7,38.29936753,11.70063247,7115
,350,8,50.82949309,0.82949309,2170
,350,9,91.33064516,41.33064516,496
,350,10,100,50,7
,350,11,100,50,9
,350,12,95.62443026,45.62443026,1097
,350,13,98.28571429,48.28571429,175
,350,14,39.69465649,10.30534351,2227
,350,15,58.99201322,8.99201322,3631
,350,16,74.64788732,24.64788732,426
,350,17,95.50561798,45.50561798,89
,350,19,100,50,13
,350,24,24.86702128,25.13297872,752
,350,25,12.56544503,37.43455497,191
,350,26,0,50,6
,350,27,33.33333333,16.66666667,3
,350,28,69.25996205,19.25996205,1054
,350,29,78.33935018,28.33935018,277
,350,30,81.89935065,31.89935065,1232
,350,31,51.63043478,1.63043478,4232
,350,32,44.43735375,5.56264625,4701
,350,33,60.50761421,10.50761421,985
,350,34,16.07142857,33.92857143,112
,350,35,92.5257732,42.5257732,388
,350,36,78.80794702,28.80794702,302
,350,38,100,50,256
,350,39,88.5,38.5,400
,350,40,0,50,3
,350,44,0,50,35
,350,46,28.50678733,21.49321267,221
,350,47,89.84375,39.84375,128
,350,48,52.4779101,2.4779101,5206
,350,49,71.33204633,21.33204633,2072
,350,50,14.11042945,35.88957055,163
,350,51,63.86597938,13.86597938,1940
,350,52,95.78947368,45.78947368,190
,350,53,100,50,49
,350,54,0,50,2
,350,55,60.29411765,10.29411765,136
,350,56,54.37635513,4.37635513,8763
,350,57,53.91740641,3.91740641,2591
,350,58,39.13043478,10.86956522,322
,350,59,48.73617694,1.26382306,1266
,350,60,43.39839265,6.60160735,13065
,350,61,46.52661064,3.47338936,3570
,350,62,49.45496484,0.54503516,26879
,350,63,45.97186227,4.02813773,54020
,400,0,45.76484748,4.23515252,53174
,400,1,41.99620861,8.00379139,22683
,400,2,28.14930016,21.85069984,3858
,400,3,34.89431718,15.10568282,15802
,400,4,74.9516441,24.9516441,1034
,400,5,73.45971564,23.45971564,211
,400,6,46.26865672,3.73134328,1943
,400,7,46.45640074,3.54359926,5390
,400,8,31.19266055,18.80733945,763
,400,9,43.56435644,6.43564356,202
,400,11,100,50,32
,400,12,80.49678013,30.49678013,1087
,400,13,83.73626374,33.73626374,455
,400,14,77.1468144,27.1468144,1444
,400,15,49.37597504,0.62402496,3846
,400,16,0,50,80
,400,24,38.02345059,11.97654941,597
,400,25,95.35519126,45.35519126,366
,400,26,100,50,11
,400,27,100,50,2
,400,28,35.82317073,14.17682927,656
,400,29,38.94389439,11.05610561,303
,400,30,41.29886507,8.70113493,1586
,400,31,57.94777829,7.94777829,4366
,400,32,41.94796818,8.05203182,4651
,400,33,42.10526316,7.89473684,475
,400,34,100,50,126
,400,35,98.39786382,48.39786382,749
,400,36,98.11320755,48.11320755,53
,400,37,100,50,15
,400,38,100,50,5
,400,39,67.81857451,17.81857451,463
,400,40,0,50,118
,400,44,38.27838828,11.72161172,1092
,400,45,82.22222222,32.22222222,180
,400,46,96.78832117,46.78832117,685
,400,47,79.36117936,29.36117936,814
,400,48,60.08779631,10.08779631,5695
,400,49,58.98876404,8.98876404,1602
,400,50,0,50,54
,400,51,48.07692308,1.92307692,936
,400,52,0,50,52
,400,54,20.37586548,29.62413452,1011
,400,55,75.38461538,25.38461538,325
,400,56,50.03221234,0.03221234,7761
,400,57,62.55805645,12.55805645,2799
,400,58,100,50,240
,400,59,72.03151379,22.03151379,1777
,400,60,51.01915709,1.01915709,13050
,400,61,34.09610984,15.90389016,2622
,400,62,47.291813,2.708187,25626
,400,63,46.21710526,3.78289474,55936
,450,0,42.528419,7.471581,54453
,450,1,40.33231268,9.66768732,22208
,450,2,25.66302652,24.33697348,1282
,450,3,40.80205382,9.19794618,11296
,450,4,80.20979021,30.20979021,1430
,450,5,89.84375,39.84375,256
,450,6,60.45051699,10.45051699,2708
,450,7,54.26173052,4.26173052,4646
,450,8,64.42622951,14.42622951,610
,450,9,100,50,85
,450,12,49.68553459,0.31446541,954
,450,13,29.66841187,20.33158813,573
,450,14,56.85670262,6.85670262,1298
,450,15,52.05479452,2.05479452,5110
,450,16,73.19148936,23.19148936,470
,450,17,100,50,48
,450,24,1.03092784,48.96907216,291
,450,25,0,50,10
,450,28,15.61085973,34.38914027,884
,450,29,81.02678571,31.02678571,448
,450,30,40.74398249,9.25601751,2285
,450,31,34.82108503,15.17891497,5198
,450,32,37.78588001,12.21411999,3017
,450,33,59.8062954,9.8062954,2065
,450,34,6.21019108,43.78980892,628
,450,35,57.90513834,7.90513834,1012
,450,36,24.48304384,25.51695616,1209
,450,37,100,50,328
,450,38,100,50,354
,450,39,83.08668076,33.08668076,473
,450,44,100,50,71
,450,46,100,50,18
,450,47,96.77419355,46.77419355,186
,450,48,33.58581511,16.41418489,5809
,450,49,57.33944954,7.33944954,872
,450,50,43,7,400
,450,51,93.0362117,43.0362117,718
,450,52,2.01005025,47.98994975,199
,450,53,100,50,202
,450,54,40.94076655,9.05923345,574
,450,55,74.78005865,24.78005865,341
,450,56,66.91042048,16.91042048,7111
,450,57,60.89401181,10.89401181,3557
,450,58,89.79057592,39.79057592,382
,450,59,69.71631206,19.71631206,1410
,450,60,54.46520875,4.46520875,12575
,450,61,43.45637584,6.54362416,2384
,450,62,45.37255829,4.62744171,25392
,450,63,47.40957112,2.59042888,57172
,500,0,41.77087535,8.22912465,54538
,500,1,42.73385434,7.26614566,20857
,500,2,41.67507568,8.32492432,1982
,500,3,34.07946878,15.92053122,9337
,500,4,50.75012933,0.75012933,1933
,500,5,38.66666667,11.33333333,300
,500,6,79.94680851,29.94680851,1880
,500,7,63.81771954,13.81771954,5113
,500,8,7.2,42.8,250
,500,12,41.51712887,8.48287113,1226
,500,13,72.319202,22.319202,401
,500,14,41.54676259,8.45323741,2224
,500,15,42.32296492,7.67703508,6044
,500,16,100,50,257
,500,17,100,50,17
,500,24,82.75193798,32.75193798,516
,500,25,99.65156794,49.65156794,574
,500,28,7.96460177,42.03539823,226
,500,29,9.09090909,40.90909091,44
,500,30,34.81551561,15.18448439,2114
,500,31,40.81092095,9.18907905,4908
,500,32,43.05630027,6.94369973,3730
,500,33,58.26036194,8.26036194,3426
,500,34,54.54545455,4.54545455,253
,500,35,58.81809788,8.81809788,1083
,500,36,100,50,12
,500,38,100,50,82
,500,39,55.64681725,5.64681725,487
,500,46,100,50,51
,500,47,87.67123288,37.67123288,73
,500,48,29.56696878,20.43303122,4965
,500,49,68.75,18.75,1104
,500,50,43.45794393,6.54205607,214
,500,51,55.61959654,5.61959654,1041
,500,52,13.54581673,36.45418327,1255
,500,53,100,50,353
,500,54,62.16216216,12.16216216,925
,500,55,95.05976096,45.05976096,1255
,500,56,64.30059731,14.30059731,7199
,500,57,48.56797096,1.43202904,2479
,500,58,16.17473436,33.82526564,847
,500,59,65.02242152,15.02242152,446
,500,60,52.832,2.832,12500
,500,61,62.28836701,12.28836701,3662
,500,62,45.24454148,4.75545852,22900
,500,63,46.46622749,3.53377251,58139
};

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
      visibel=false;
      if(Symbol()!="EURUSD")return(0);
      switch(Period()) 
     { 
      case PERIOD_M1  : visibel=true;   break;
      case PERIOD_M5  : visibel=false;  break;
      case PERIOD_M15 : visibel=false;  break;
      case PERIOD_M30 : visibel=false;  break;
      case PERIOD_H1  : visibel=false;  break;
      case PERIOD_H4  : visibel=false;  break;
      case PERIOD_D1  : visibel=false;  break;
      case PERIOD_W1  : visibel=false;
     }

   if(!visibel)return(0);
   
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,Blue);
   SetIndexBuffer(0,Oksn);
   SetIndexStyle(1,DRAW_LINE,STYLE_DOT,1,Red);
   SetIndexBuffer(1,GridF);
   SetIndexStyle(2,DRAW_LINE,STYLE_DOT,1,Green);
   SetIndexBuffer(2,AllF);
   SetIndexStyle(3,DRAW_NONE);
   SetIndexBuffer(3,Grid);
   SetIndexStyle(4,DRAW_NONE);
   SetIndexBuffer(4,All);

   IndicatorShortName("!Oksn ("+GRIDSTART+","+GRIDEND+","+N+")");
   SetIndexLabel(0,"U%");
   SetIndexLabel(1,NULL);
   SetIndexLabel(2,NULL);
   SetIndexLabel(3,"Grid");
   SetIndexLabel(4,"All");
   
   SetIndexEmptyValue(0,EMTYVAL);
   SetIndexEmptyValue(1,EMTYVAL);
   SetIndexEmptyValue(2,EMTYVAL);
   SetIndexEmptyValue(3,EMTYVAL);
   SetIndexEmptyValue(4,EMTYVAL);
   
   SetIndexDrawBegin(0,GRIDEND);
   SetIndexDrawBegin(1,GRIDEND);
   SetIndexDrawBegin(2,GRIDEND);
   SetIndexDrawBegin(3,GRIDEND);
   SetIndexDrawBegin(4,GRIDEND);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectDelete("Info");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//----
   if(!visibel)return(0);

   //--- Find MaxAll Onece Start
   static double MaxAll=0;
   if(MaxAll==0)for(int a=0; a<TABELSIZE; a++){
      if(MaxAll<Tabel[a,4])MaxAll=Tabel[a,4];
   }
   //--- Find MaxAll Onece End
   
   int counted_bars=IndicatorCounted();   

//---- check for possible errors
   if(Bars<=GRIDEND)return(0);
   if(counted_bars<0)return(0);
   
  //---- main loop
     int limit=Bars-counted_bars;
     if(limit>LIMIT)limit=LIMIT;
     for(a=limit; a>=0; a--){
      for(int grid=GRIDSTART; grid<=GRIDEND; grid+=STEP){
      int ii=(grid-GRIDSTART)/STEP;
         //double MomentumWeight[(GRIDEND-GRIDSTART)/STEP+1,5];
         double MomentumWeight[10,5];
         MomentumWeight[ii,1]=EMTYVAL;
         int j=a+1;
         for(int n=0; n<N; n++){
            bool u=false, d=false;
            while(!u && !d && j<Bars){
               if(Close[j]-Close[a]>=+(n+1)*grid*Point)d=true;
               if(Close[j]-Close[a]<=-(n+1)*grid*Point)u=true;
               j++;
            }
            if(!u && !d){MomentumWeight[ii,1]=EMTYVAL; break;}
            if(u)MomentumWeight[ii,1]+=MathPow(2,n);
         }
         MomentumWeight[ii,0]=grid;
      
         //--- fill U && dif
         for(int i=0; i<=((GRIDEND-GRIDSTART)/STEP+1)*MathPow(2,N); i++){
            if(Tabel[i,0]==MomentumWeight[ii,0] && Tabel[i,1]==MomentumWeight[ii,1]){MomentumWeight[ii,2]=Tabel[i,2]; MomentumWeight[ii,3]=Tabel[i,3]; MomentumWeight[ii,4]=Tabel[i,4]; break;}
         }
      }
   
      //--- find Max Dif
      double MaxDif=EMTYVAL; int p=0;
      for(i=0; i<GRIDEND/GRIDSTART; i++){
         if(MomentumWeight[i,3]>MaxDif){MaxDif=MomentumWeight[i,3]; p=i;}
      }
     Oksn[a]=MomentumWeight[p,2];
     if(MaxDif!=EMTYVAL)GridF[a]=100*MomentumWeight[p,0]/GRIDEND; else GridF[a]=EMTYVAL;
     if(MaxDif!=EMTYVAL)Grid[a]=MomentumWeight[p,0]; else Grid[a]=EMTYVAL;
     if(MaxDif!=EMTYVAL)AllF[a]=100*MomentumWeight[p,4]/MaxAll; else AllF[a]=EMTYVAL;
     if(MaxDif!=EMTYVAL)All[a]=MomentumWeight[p,4]; else All[a]=EMTYVAL;
     }
  //---- main loop
   
   static double OldDif=EMTYVAL;
   if(OldDif==MaxDif)return(0);
   OldDif=MaxDif;

   if(MaxDif==EMTYVAL){ObjectDelete("Info"); return(0);}
   
   string Info="Up "+DoubleToStr(MathRound(MomentumWeight[p,2]),0)+"%";
   color Color=Green;
   if(MomentumWeight[p,2]<50){Info="Dn "+DoubleToStr(MathRound(100-MomentumWeight[p,2]),0)+"%"; Color=Red;}
   Info=Info+"("+DoubleToStr(MomentumWeight[p,4],0)+") "+DoubleToStr(MomentumWeight[p,0],0)+"p";
   ObjectCreate("Info",OBJ_LABEL,0,0,0);
   ObjectSet("Info",OBJPROP_CORNER,3);
   ObjectSet("Info",OBJPROP_XDISTANCE,10);
   ObjectSet("Info",OBJPROP_YDISTANCE,10);
   ObjectSetText("Info",Info,6,"Arial Black",Color);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---