Same LWMA(240) 1H values in all Lower TFs ?

Post Reply
rivelrivella
Trader
Posts: 36
Joined: Mon Sep 01, 2014 8:54 pm

Same LWMA(240) 1H values in all Lower TFs ?

Post by rivelrivella »

Hi,

Could anyone help me how to code IMA formula to give me LWMA (240 periods) for 1 Hour Period, whatever Lower Time Frame is ? (5M, 15M, 30M).

So if I have 15min Chart, I'd like to have the same value of LWMA240 for 9H15, 9H30, 9H45 or 10H
And if I have the 30 min chart, I'd like to have the same value of LWMA240 for 9H30 or 10H

So when changing TF chart (Less than 1H) I'd like to have the same LWMA curve.

Thanks
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Same LWMA(240) 1H values in all Lower TFs ?

Post by milanese »

rivelrivella » Wed Oct 01, 2014 10:53 pm wrote:Hi,

Could anyone help me how to code IMA formula to give me LWMA (240 periods) for 1 Hour Period, whatever Lower Time Frame is ? (5M, 15M, 30M).

So if I have 15min Chart, I'd like to have the same value of LWMA240 for 9H15, 9H30, 9H45 or 10H
And if I have the 30 min chart, I'd like to have the same value of LWMA240 for 9H30 or 10H

So when changing TF chart (Less than 1H) I'd like to have the same LWMA curve.

Thanks
Hi,

you can code it in the same way I did it with the MTF stoch in 10.7 stoch indi..

Code: Select all

// Plot defined timeframe on to current timeframe   
   ArrayCopySeries(TimeArray1,MODE_TIME,Symbol(),PERIOD_H1);
 limit=Bars-counted_bars+PERIOD_H1/Period();
for(i=0,y1=0;i<limit;i++)

     {
      if(Time[i]<TimeArray1[y1]) y1++;
      MA_value=iMA(symbol,PERIOD_H1,240,0,MODE_LWMA,PRICE_CLOSE,y1);
     
}
Cheers :)


Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
Lowphat
Trader
Posts: 121
Joined: Fri Jun 27, 2014 12:20 am

Same LWMA(240) 1H values in all Lower TFs ?

Post by Lowphat »

if your using a fixed number u can also probably do something like

init
if (period == 1h) MAPeriod = 240
if (period == 30m) MAPeriod = 480
if (period == 15m) MAPeriod = 960
if (period == 5m) MAPeriod = 2880
if (period == 240m) MAPeriod = 60
if (period == 1440m MAPeriod = 10
if period> a day MAPeriod = 1
etc...
that way your line wont be aliased if your looking at it visually
rivelrivella
Trader
Posts: 36
Joined: Mon Sep 01, 2014 8:54 pm

Same LWMA(240) 1H values in all Lower TFs ?

Post by rivelrivella »

Thank you a lot Tommaso, for your help.
Post Reply

Return to “Coders Hangout”