- I'm confused
- trying to capture values for EMA.5, EMA.10 and SMA.50 and SMA.100
- Cature RSI Value
Can you post your code?
It is very difficult to guess what is the problem without more information.
An EMA must never show negative values. It represents an averaged price of the asset you are using. The market prices are never negative, therefore your EMA must also not be negative.
Can you post your code?
It is very difficult to guess what is the problem without more information.
An EMA must never show negative values. It represents an averaged price of the asset you are using. The market prices are never negative, therefore your EMA must also not be negative.
That's what I thought. Its obvious Im doing something wrong but I can't seem to locate it the error/bug. Im trying to copy two EMA values into an array. EMA 5 and EMA 10. Thoughts? And thanks in advance for the help!
EMA5_Handle=iMA(Symbol(),0,5,0,MODE_E<A,InpAppliedPrice1);
EMA5_Handle=iMA(Symbol(),0,10,0,MODE_E<A,InpAppliedPrice1);
CopyBuffer(EMA5_Handle,MODE_EMA,0,17,EMA5_ARRAY);
ArraySetAsSeries(EMA5_ARRAY,true);
CopyBuffer(EMA10_Handle,MODE_EMA,0,17,EMA10_ARRAY);
ArraySetAsSeries(EMA10_ARRAY,true);
Can you try setting the mode to MODE_EMA.
You have misspelled the therm to MODE_E<A
Can you try setting the mode to MODE_EMA.
You have misspelled the therm to MODE_E<A
MY mistake; that was a bad cut and paste. Below is the code without any variables or misspellings...
EMA5_Handle=iMA(Symbol(),0,5,0,MODE_EMA,PRICE_CLOSE); EMA5_Handle=iMA(Symbol(),0,10,0,MODE_EMA,PRICE_CLOSE); CopyBuffer(EMA5_Handle,MODE_EMA,0,17,EMA5_ARRAY); ArraySetAsSeries(EMA5_ARRAY,true); CopyBuffer(EMA10_Handle,MODE_EMA,0,17,EMA10_ARRAY); ArraySetAsSeries(EMA10_ARRAY,true);
MY mistake; that was a bad cut and paste. Below is the code without any variables or misspellings...
EMA5_Handle=iMA(Symbol(),0,5,0,MODE_EMA,PRICE_CLOSE); EMA5_HandleEMA10_Handle=iMA(Symbol(),0,10,0,MODE_EMA,PRICE_CLOSE);Your code doesn't include any error processing, it's very bad practice.
You used 2 times the same handle :
Your code doesn't include any error processing, it's very bad practice.
Thanks Alan and I will include more error handling in my code. Do you think the problem might be my CopyBuffer command? Or could it be something else?
EMA5_Handle=iMA(Symbol(),0,5,0,MODE_EMA,PRICE_CLOSE); EMA5_Handle=iMA(Symbol(),0,10,0,MODE_EMA,PRICE_CLOSE); SMA50_Handle=iMA(Symbol(),0,50,0,MODE_SMA,PRICE_CLOSE); CopyBuffer(EMA5_Handle,MODE_EMA,0,17,EMA5_ARRAY); ArraySetAsSeries(EMA5_ARRAY,true); CopyBuffer(EMA10_Handle,MODE_EMA,0,17,EMA10_ARRAY); ArraySetAsSeries(EMA10_ARRAY,true); CopyBuffer(SMA50_Handle,MODE_SMA,0,17,SMA50_ARRAY); ArraySetAsSeries(SMA50_ARRAY,true);
Thanks Alan and I will include more error handling in my code. Do you think the problem might be my CopyBuffer command? Or could it be something else?
Thanks Alan and I will include more error handling in my code. Do you think the problem might be my CopyBuffer command? Or could it be something else?
No I must have missed what you are referring to. I saw where you corrected my spelling of EMA10_Handle and other than using the source button Im confused.
Exactly I changed the variable name. But in the code you posted after, it's again 2 times EMA5_Handle.
By the way, you still don't show the code where we can see you get negative values. Which values ? Which array, indexes ?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use