|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
change ind in a EA
i would like to change the indicator in a EA i have,but i don't know how to do it
i am not a programmer in fact don't much about this kind kind of thing, below is the only part that relates to the indicator i want to change the DiMA to MFA(14) i want to buy @ >60 and sell@<40 double diClose0=iClose(NULL,5,0); double diMA1=iMA(NULL,5,7,0,MODE_SMA,PRICE_OPEN,0); double diClose2=iClose(NULL,5,0); double diMA3=iMA(NULL,5,6,0,MODE_SMA,PRICE_OPEN,0); if(AccountFreeMargin()<(1000*Lots)){ Print("We have no money. Free Margin = ", AccountFreeMargin()); return(0); } if (!ExistPositions()){ if ((diClose0<diMA1)){ OpenBuy(); return(0); } if ((diClose2>diMA3)){ OpenSell(); return(0); } } could someone please help me denis |
|
||||
|
This one? Market Facilitation Index
__________________
|
|
||||
|
Quote:
Money Flow Index.mq4 aka MFI.mq4
__________________
|
|
|||
|
Anybody help me please
Hi
Ive tried to create an indicator and was wondering to see if someone can help me (i feel its 99.9% finished - well phase I anyway) I just want an arrow when the CCI cross over zero line and the stoc crosses upwards (ideally the first time) - reverse for second time //+------------------------------------------------------------------+ //| CCI_Stoc_Xover.mq4 | //| Copyright © 2007, MetaQuotes Software Corp. | //| Forex Trading Software: Forex Trading Platform MetaTrader 4 | //+------------------------------------------------------------------+ #property copyright "Copyright © 2007, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 SeaGreen #property indicator_color2 Red extern int CCI_Period = 14; extern int Stoc_K=5; extern int Stoc_D=3; extern int Stoc_Slowing=3; double CrossUp[]; double CrossDown[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0, DRAW_ARROW, EMPTY,3); SetIndexArrow(0, 233); SetIndexBuffer(0, CrossUp); SetIndexStyle(1, DRAW_ARROW, EMPTY,3); SetIndexArrow(1, 234); SetIndexBuffer(1, CrossDown); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit, i, counter; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(i = 0; i <= limit; i++) { counter=i; double cci_1 = iCCI(Symbol(), Period(), CCI_Period, PRICE_TYPICAL, 1); double cci_2 = iCCI(Symbol(), Period(), CCI_Period, PRICE_TYPICAL, 2); double stok_0 = iStochastic(Symbol(), Period(), Stoc_K, Stoc_D, Stoc_Slowing, MODE_SMA, 0, MODE_MAIN, 0); double stod_0 = iStochastic(Symbol(), Period(), Stoc_K, Stoc_D, Stoc_Slowing, MODE_SMA, 0, MODE_SIGNAL, 0); double stok_1 = iStochastic(Symbol(), Period(), Stoc_K, Stoc_D, Stoc_Slowing, MODE_SMA, 0, MODE_MAIN, 1); double stod_1 = iStochastic(Symbol(), Period(), Stoc_K, Stoc_D, Stoc_Slowing, MODE_SMA, 0, MODE_SIGNAL, 1); if ((cci_2 <= 0 && cci_1 > 0 && stok_1 < stod_1 && stok_0 > stod_0)) { CrossUp[i] = Low[i]; } else if ((cci_2 >= 0 && cci_1 < 0 && stok_1 > stod_1 && stok_0 < stod_0)) { CrossDown[i] = High[i]; } } return(0); } |
|
|||
|
One obvious thing is that you are missing a declaration for the number of indicator buffers that you are going to use.
This sits in the first part of init eg int init() { IndicatorBuffers(2); ..... } Give it a go and see if it fixes your problem. Note I haven't fully checked the code, I simply checked for obvious errors. Cheers, Hiachiever. Quote:
|
|
|||
|
Hi,
A little further review has uncovered your problem. What you have done is not add in correct referencing of your indicators, these should have the variable 'i' as a reference not a specific bar number. EG. This is incorrect. double cci_1 = iCCI(Symbol(), Period(), CCI_Period, PRICE_TYPICAL, 1); double cci_2 = iCCI(Symbol(), Period(), CCI_Period, PRICE_TYPICAL, 2); It should be double cci_1 = iCCI(Symbol(), Period(), CCI_Period, PRICE_TYPICAL, i+1); double cci_2 = iCCI(Symbol(), Period(), CCI_Period, PRICE_TYPICAL, i+2); Cheers, Hiachiever Quote:
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to code this? | iscuba11 | Metatrader 4 mql 4 - Development course | 1 | 08-03-2007 04:22 PM |