|
|||||||
| Forex Laboratory Discussion forum for Forex traders. |
![]() |
|
|
LinkBack (3) | Thread Tools | Search this Thread | Display Modes |
|
||||||||||||||||||||||||||||||
|
Re: The Chimp`s "Forex Trades"
Have opened a Ninja account and an EFX account but have not taken on the learning curves with either. Significant programming efforts will probably get done in NT and only easy stuff done in MT4. I still use MT4 charts for trading and for my own currency based indicators which are what I have been working on for 9 months and am still working on because they are central to my trading but they are difficult to interpret still. Walters vma entry timing is now used for trading as well. I will still be using MT4 and doing basic programming jobs in MT4. I may start trading futures and I may switch to an ndd for forex but if either happens it will probably be next year.
That group of vma6_nBar lines used.. double WeightDM=ADX_Bars, WeightDI=ADX_Bars, WeightDX=ADX_Bars, ChandeEMA=ADX_Bars; So changing the ADX_Bars number also changed the smoothing. The fancy stuff like VI squared was commented out in the code. Yeah, there are too many threads and too many posts to find this stuff now. On the 1min chart 6bar was used (and set to 6) and 4bar (but set to 3). On the 5min chart 12bar was used (but set to 4 bars). The 5min trend line used 16bar (but set to 40 bars). It made sense at the time even if it seems nuts now. Test3 was the final test, it became adxvma6 (without the "testn"). I repeatedly got confused over the stochastic loop counting and live bars versus historical bars and it still needs to be sorted. The adxvma6 used... if (Out[i]>Out[i+1]){HHV=Out[i];LLV=Out[i+1];} else {HHV=Out[i+1];LLV=Out[i];} for(j=1;j<ADX_Bars;j++) { if(Out[i+j+1]>HHV)HHV=Out[i+j+1]; if(Out[i+j+1]<LLV)LLV=Out[i+j+1]; } It was intended that the first comparison of two bars (one may be live) would be done before the loop and the loop would be used only for 3 bars or greater, but that isnt how it was working... Should have used... if (Out[i]>Out[i+1]){HHV=Out[i];LLV=Out[i+1];} else {HHV=Out[i+1];LLV=Out[i];} for(j=1;j<ADX_Bars-1;j++) { if(Out[i+j+1]>HHV)HHV=Out[i+j+1]; if(Out[i+j+1]<LLV)LLV=Out[i+j+1]; } What difference does it make? When you ask for ADX_Bars=2, you get 2 ok. But when you ask for 3 you get 4 instead. And so on, ask for 4 get 5 etc. With the adxvma6_nbar series this will mean using different numbers for adx_bars and also for ema smoothing on other platforms and there may be a further complication with the smoothing weights needing to be different (may need to use numbers other than whole integer values).
Drives ya nuts doesn't it? Cheers Bruce |
||||||||||||||||||||||||||||||
|
|||||||||||||||
|
Re: The Chimp`s "Forex Trades"
|
|||||||||||||||
|
|||||||||||||||
![]() ![]() Is your entry the red vma(4) crossing the green vma(6) or the white decema(12) crossing the red vma(4) ? could you please post the mq4 code for the decema? regards. Unicorn. |
|||||||||||||||
|
|||||||||||||||
wilders(value, wilders_periods) = ema(value, 2*wilders_periods -1); hence wilders(c, 3) is ema(c, 5) wilders(c, 4) is ema(c, 7) wilders(c, 5) is ema(c, 9) wilders(c, 6) is ema(c, 11) etc. Now, I mention this because you guys are missing intermediate settings; in the above cited examples from smoothing using ema of 5 periods your implementation jumps to 7, and then 9 and 11 ema periods. Your programming the adx computation in order to have an additional smoothing (for a total of three smoothing operations as opposed to Wilder's two smoothing operations) may be lacking some effectiveness on account of using half the resolution because you move in ema_period steps of 2 i.e ema_periods = 5,7,9,11 as opposed to 4,5,6,7,8,9,10,11. I hope that my point is clear. Wilder did not mind that; then again he did not have any use for three smoothing operations; he was not scalping. Bruce (and Sparrow) you can code the vma vma[j] = (1 - f*f_adx) vma[j-1] + (f*f_adx) C[j] ; where f = 2 / (ema_periods +1) and f_adx is the stochastic_adx value. in the stochastic adx smoothing operations you can use smooth_x[j] = (1-g) * smooth_x[j-1] + g * x[j]; for the PDM, PDI, Out, etc. Then adxvma(6) will correspond to the new implementation using weightdm = weightdi = weightdx = 2*6 - 1 =11 stochastic_periods = 6 (the one called adx_bars) in the following code for(j=1;j<ADX_Bars;j++) { if(Out[i+j+1]>HHV)HHV=Out[i+j+1]; if(Out[i+j+1]<LLV)LLV=Out[i+j+1]; } and ema_periods = ChandeEMA = 11; the ChandeEMA variable in MA[i]=((ChandeEMA-VI)*MA[i+1]+VI*Close[i])/ChandeEMA; Hope this helps in cleaning up the code. ![]() cheers Unicorn. |
|||||||||||||||
|
|||||||||||||||
|
Re: The Chimp`s "Forex Trades"
Hi Walter, PYenner, Unicorn and sundouner.
Great interaction that you have here. It looks like a pretty game seen from the chairs of a stadium.
It is really a very important point... NinjaTrader has 3 forex sources of data and as I understand the confidence order of the data is: TradeStation, eSignal and the last could be data form Gain Capital. But to obtain any of them in order to work with live data as I understand we must pay for, or open a live account with TradeStation or Gain Capital...This condition make me think if it is better to compare NT with other chart packages like Amibroker, Ensign, or any other that have charts with ticks or seconds at least. NinjaTrader has excellent capacities and also it allows to work with a different kind of markets, But I think it would be advisable to develop more this topic... Regards. AgustÃÂ*n |
|||||||||||||||
|
|||||||||||||||
Yes it does drive me nuts. Walter is putting in a lot of time. You have put in a lot of time. I have put in a lot of time. Now that Walter wants to come up with the final formulation, I believe that the tools that he and we will use must be in top shape. That's why I will help you clean the code. As a matter of fact I already did. The following code incorporates my suggestions for higher ema resolution. The added benefit is that this code will run faster, as it by-passes the Wilder's divisions in the previous implementation. Divisions need more cpu time than multiplications. // adxvma_U // Unicorn's modification to adxvma6 computation 18-11-2007 factor1 = 2 / (dm_ema_periods +1); //default for adxvma(6) is dm_ema_periods=11; factor2 = 2 / (di_ema_periods +1); //default for adxvma(6) is di_ema_periods=11; factor3 = 2 / (dx_ema_periods +1); //default for adxvma(6) is dx_ema_periods=11; alpha = 2 / (chande_ema_periods +1); //default for adxvma(6) is chande_ema_periods=11; for(i=i; i>=0; i--) //Main loop begins after history bars filled. { PDM[i]=0; MDM[i]=0; if(Close[i]>Close[i+1])PDM[i]=Close[i]-Close[i+1];//This array is not displayed. else MDM[i]=Close[i+1]-Close[i];//This array is not displayed. PDM[i]=((1-factor1)*PDM[i+1] + factor1 * PDM[i]) ; // REAL ema. MDM[i]=((1-factor1)*MDM[i+1] + factor1 * MDM[i]) ; //REAL ema. TR=PDM[i]+MDM[i]; if (TR>0) {PDI[i]=PDM[i]/TR; MDI[i]=MDM[i]/TR;} //Avoid division by zero. Minimum step size is one unnormalized price pip. else {PDI[i]=0; MDI[i]=0;} PDI[i]=(( 1- factor2 )*PDI[i+1] + factor2 * PDI[i]); // REAL ema. MDI[i]=(( 1- factor2 )*MDI[i+1] + factor2 * MDI[i]); // REAL ema. DI_Diff=PDI[i]-MDI[i]; if (DI_Diff<0) DI_Diff= -DI_Diff;//Only positive momentum signals are used. DI_Sum=PDI[i]+MDI[i]; DI_Factor=0; //Zero case, DI_Diff will also be zero when DI_Sum is zero. if (DI_Sum>0) Out[i]=DI_Diff/DI_Sum; //Factional, near zero when PDM==MDM (horizonal), near 1 for laddering. else Out[i]=0; Out[i]=((1- factor3 )*Out[i+1] + factor3 * Out[i]) ; // REAL ema. if (Out[i]>Out[i+1]){HHV=Out[i];LLV=Out[i+1];} else {HHV=Out[i+1];LLV=Out[i];} for(j=1;j<stochastic_peri ods;j++) // default for adxvma(6) is stochastic_periods=6; { if(Out[i+j+1]>HHV)HHV=Out[i+j+1]; if(Out[i+j+1]<LLV)LLV=Out[i+j+1]; } diff = HHV - LLV; //Denominator of stochastics VI=0; if (diff>0) VI=(Out[i]-LLV)/diff; //stochastic computation of modified adx. MA[i]=((1 - alpha * VI) * MA[i+1] + alpha * VI *Close[i] ; //Chande VMA formula. } // ENJOY ok guys. Try | |||||||||||||||