What I am working on is a method using stochastics to ride the trend. By applying different sto levels at different points in the chart, you can ride the trend longer and still be fairly quick about getting out. I am having a problem coding this correctly (I think) and need some expert help.
double buy1 = iStochastic(NULL,0,25, 2,3,MODE_SMA,0,MODE_MAIN,0);
double buy2 = iStochastic(NULL,0,13, 8,8,MODE_SMA,0,MODE_SIGNAL,0);
double buy3 = iStochastic(NULL,0,13,13,8,MODE_SMA,0,MODE_SIGNAL, 0);
double buy4 = iStochastic(NULL,0,13,21,8,MODE_SMA,0,MODE_SIGNAL, 0);
double buy5 = iStochastic(NULL,0,13,34,8,MODE_SMA,0,MODE_SIGNAL, 0);
double buy6 = iStochastic(NULL,0,13,55,8,MODE_SMA,0,MODE_SIGNAL, 0);
if (buy1 < buy2 && buy2 < 95) OrderClose
if (buy2 > 95) continue;
if (buy1 < buy3 && buy3 < 95) OrderClose
if (buy3 > 95) continue;
if (buy1 < buy4 && buy4 < 95) OrderClose
if (buy4 > 95) continue;
if (buy1 < buy5 && buy5 < 95) OrderClose
if (buy5 > 95) continue;
if (buy1 < buy6 && buy6 < 95) OrderClose etc
The idea here being that the main 25,2,3 will get to the top quicker and stay there while the signal comes up slower and allows you to
adjust the signal. Whereas if the market becomes volatile the main will cross and close the trade. You can set the volatility you will
accept by adjusting the stoch levels. The problem I'm encountering is getting to the next level if (buy2 > 95) continue; is this the correct code or should it be something else???? thanks
double buy1 = iStochastic(NULL,0,25, 2,3,MODE_SMA,0,MODE_MAIN,0);
double buy2 = iStochastic(NULL,0,13, 8,8,MODE_SMA,0,MODE_SIGNAL,0);
double buy3 = iStochastic(NULL,0,13,13,8,MODE_SMA,0,MODE_SIGNAL, 0);
double buy4 = iStochastic(NULL,0,13,21,8,MODE_SMA,0,MODE_SIGNAL, 0);
double buy5 = iStochastic(NULL,0,13,34,8,MODE_SMA,0,MODE_SIGNAL, 0);
double buy6 = iStochastic(NULL,0,13,55,8,MODE_SMA,0,MODE_SIGNAL, 0);
if (buy1 < buy2 && buy2 < 95) OrderClose
if (buy2 > 95) continue;
if (buy1 < buy3 && buy3 < 95) OrderClose
if (buy3 > 95) continue;
if (buy1 < buy4 && buy4 < 95) OrderClose
if (buy4 > 95) continue;
if (buy1 < buy5 && buy5 < 95) OrderClose
if (buy5 > 95) continue;
if (buy1 < buy6 && buy6 < 95) OrderClose etc
The idea here being that the main 25,2,3 will get to the top quicker and stay there while the signal comes up slower and allows you to
adjust the signal. Whereas if the market becomes volatile the main will cross and close the trade. You can set the volatility you will
accept by adjusting the stoch levels. The problem I'm encountering is getting to the next level if (buy2 > 95) continue; is this the correct code or should it be something else???? thanks