Hi...
I tried to convert custom indicator to expert advisor. Based on the code, i tried to print out iMAONArray values but its return blank... Why and what is the fucntion used for ?.. Please help me
Hi..
What do you means MA buffer.. sorry this is my first experience... could you help me ?
Hi..
What do you means MA buffer.. sorry this is my first experience... could you help me ?
Your iMAOnArray() call . . .
RSIMA = iMAOnArray(MA, 0, SF, 0, MODE_EMA, 0);
. . . the first parameter is the Array, in your call MA[], but I don't see where you are adding any values to this buffer. Perhaps you EA code is different ?
Your iMAOnArray() call . . .
. . . the first parameter is the Array, in your call MA[], but I don't see where you are adding any values to this buffer. Perhaps you EA code is different ?
Ops... I'm sorry... I forgot to replace it after try test and error..The code should be like this:-
RSIMA=iMAOnArray(RSI, 0, SF, 0, MODE_EMA, 0); FileWrite(handle, "-> RSIMA : " + iMAOnArray(RSI, 0, SF, 0, MODE_EMA, 0));
Ops... I'm sorry... I forgot to replace it after try test and error..The code should be like this:-
That should be working better now ?
This thread may help . . . https://www.mql5.com/en/forum/143479
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi...
I tried to convert custom indicator to expert advisor. Based on the code, i tried to print out iMAONArray values but its return blank... Why and what is the fucntion used for ?.. Please help me
#property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_style1 STYLE_SOLID #property indicator_width1 2 #property indicator_color2 Yellow #property indicator_style2 STYLE_DOT // List of input parameter extern int SF = 45; extern int RSI_PERIOD = 55; extern double DARFACTOR = 2.236; extern double Lots = 0.01; extern int ALERTLEVEL = 50; // List of Global Array double TRLEVELSLOW[]; double ATRRSI[]; double MAATRRSI; double RSI[]; double MA[]; double RSIMA; // List of global variable int WILDERS_PERIOD, LASTALERTBAR, STARTBAR, handle; int TRACE = 1; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- Open trace file if (TRACE == 1) handle = FileOpen("BPower.csv",FILE_CSV|FILE_READ|FILE_WRITE,','); WILDERS_PERIOD = RSI_PERIOD * 2 - 1; /* if (WILDERS_PERIOD < SF) STARTBAR = SF; else STARTBAR = WILDERS_PERIOD; //---- Write to test file for trace if (TRACE == 1) { if(handle < 1) { Comment("File BPower.csv not found, the last error is ", GetLastError()); return(false); } else { FileWrite(handle, "TIME ","BID ","ASK"); } } return(handle); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit(bool handle) { FileClose(handle); return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { int i =0; int COUNTED_BARS, COUNTED; double RSI0, RSI1, DAR, TR, DV; if (TRACE == 1) { FileWrite (handle, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); FileWrite (handle, TimeToStr( TimeCurrent(), TIME_DATE | TIME_SECONDS ), Bid, Ask); } if(Bars <= STARTBAR) return(0); COUNTED_BARS = IndicatorCounted(); if (TRACE == 1) FileWrite (handle, "COUNTER_BARS: " + COUNTED_BARS); COUNTED = Bars - COUNTED_BARS - 1; if (TRACE == 1) FileWrite (handle, "COUNTED : " + COUNTED); for(i=COUNTED; i>=1; i--) { RSI[i] = iRSI(NULL, 0, RSI_PERIOD, PRICE_CLOSE, i); //FileWrite(handle, "-> RSI : " + iRSI(NULL, 0, RSI_PERIOD, PRICE_CLOSE, i)); } RSIMA=iMAOnArray(MA, 0, SF, 0, MODE_EMA, 0); FileWrite(handle, "-> RSIMA : " + iMAOnArray(MA, 0, SF, 0, MODE_EMA, 0)); return(0); }This is sample output file:-
Please help me..
Thank you