Multi time frame error

#1
this is actually issue errors in displaying line values of the different time frame values in a single chart
check with 15min/hourly/daily

each time frame issue different value to other time frame values
TimeFrameSet( in15Minute ); // switch to 5 minute frame


b1=WMA(H+L+C/3,10);
b2=WMA(H+L+C/3,70);
b3=b1-b2;

ma5_13 = b3;

TimeFrameRestore(); // restore time frame to original

TimeFrameSet( inHourly ); // switch now to hourly
b11=WMA(H+L+C/3,10);
b21=WMA(H+L+C/3,70);
b31=b11-b21;

mah_9 = b31;

TimeFrameRestore(); // restore time frame to original


TimeFrameSet( inDaily ); // switch now to hourly
b12=WMA(H+L+C/3,10);
b22=WMA(H+L+C/3,70);
b32=b12-b22;

mah_d =b32; //

TimeFrameRestore(); // restore time frame to original



//Plot( Close, "Price", colorWhite, styleCandle );

// plot expanded average

Plot( TimeFrameExpand( ma5_13, in15Minute), "15 minutes", colorRed );
TimeFrameRestore();
Plot( TimeFrameExpand( MAh_9, inHourly), "houly", colorBlue );
TimeFrameRestore();
Plot( TimeFrameExpand( MAh_d, inDaily), "daily",colorWhite );
TimeFrameRestore();
 
#2
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();


////////////////////////////////////////////////////////////////////////////////////////////
TimeFrameSet(in1Minute);

rsi3401=RSI(34);
RSI34p01=RSI3401+(RSI3401*1/100);
rsi343401=EMA(Rsi3401,34);

rsi5101=RSI(51);
RSI51p01=RSI5101+(RSI5101*1/100);
rsi515101=EMA(Rsi5101,51);

rsi1401=RSI(14);
TimeFrameRestore();

rsix3401=TimeFrameExpand( rsi3401, in1Minute,expandLast );
rsix34p01=TimeFrameExpand( rsi34p01, in1Minute,expandLast );
rsix343401=TimeFrameExpand( rsi343401, in1Minute,expandLast );
rsix5101=TimeFrameExpand( rsi5101, in1Minute,expandLast );
rsix51p01=TimeFrameExpand( rsi51p01, in1Minute,expandLast );
rsix515101=TimeFrameExpand( rsi515101, in1Minute,expandLast );
rsix1401=TimeFrameExpand( rsi1401, in1Minute,expandLast );


e01c01=WriteIf(rsix34p01>rsix343401 ,"On","Off");
e01c02=WriteIf(rsix51p01>rsix515101 ,"On","Off");
e01c03=WriteIf(rsix1401>50 ,"On","Off");

e01c04=WriteIf(rsix34p01<=rsix343401 ,"On","Off");
e01c05=WriteIf(rsix51p01<=rsix515101 ,"On","Off");
e01c06=WriteIf(rsix1401<=50 ,"On","Off");

/////////////////////////////////////////////////////////////////////////////////////////////
TimeFrameSet(in5Minute);

rsi3405=RSI(34);
RSI34p05=RSI3405+(RSI3405*1/100);
rsi343405=EMA(Rsi3405,34);

rsi5105=RSI(51);
RSI51p05=RSI5105+(RSI5105*1/100);
rsi515105=EMA(Rsi5105,51);

rsi1405=RSI(14);
TimeFrameRestore();

rsix3405=TimeFrameExpand( rsi3405, in5Minute,expandLast );
rsix34p05=TimeFrameExpand( rsi34p05, in5Minute,expandLast );
rsix343405=TimeFrameExpand( rsi343405, in5Minute,expandLast );
rsix5105=TimeFrameExpand( rsi5105, in5Minute,expandLast );
rsix51p05=TimeFrameExpand( rsi51p05, in5Minute,expandLast );
rsix515105=TimeFrameExpand( rsi515105, in5Minute,expandLast );
rsix1405=TimeFrameExpand( rsi1405, in5Minute,expandLast );

e05c01=WriteIf(rsix34p05>rsix343405 ,"On","Off");
e05c02=WriteIf(rsix51p05>rsix515105 ,"On","Off");
e05c03=WriteIf(rsix1405>50 ,"On","Off");

e05c04=WriteIf(rsix34p05<=rsix343405 ,"On","Off");
e05c05=WriteIf(rsix51p05<=rsix515105 ,"On","Off");
e05c06=WriteIf(rsix1405<=50 ,"On","Off");


/////////////////////////////////////////////////////////////////////////////////////////////
TimeFrameSet(in15Minute);

rsi3415=RSI(34);
RSI34p15=RSI3415+(RSI3415*1/100);
rsi343415=EMA(Rsi3415,34);

rsi5115=RSI(51);
RSI51p15=RSI5115+(RSI5115*1/100);
rsi515115=EMA(Rsi5115,51);

rsi1415=RSI(14);
TimeFrameRestore();

rsix3415=TimeFrameExpand( rsi3415, in15Minute,expandLast );
rsix34p15=TimeFrameExpand( rsi34p15, in15Minute,expandLast );
rsix343415=TimeFrameExpand( rsi343415, in15Minute,expandLast );
rsix5115=TimeFrameExpand( rsi5115, in15Minute,expandLast );
rsix51p15=TimeFrameExpand( rsi51p15, in15Minute,expandLast );
rsix515115=TimeFrameExpand( rsi515115, in15Minute,expandLast );
rsix1415=TimeFrameExpand( rsi1415, in15Minute,expandLast );


e15c01=WriteIf(rsix34p15>rsix343415 ,"On","Off");
e15c02=WriteIf(rsix51p15>rsix515115 ,"On","Off");
e15c03=WriteIf(rsix1415>50 ,"On","Off");

e15c04=WriteIf(rsix34p15<=rsix343415 ,"On","Off");
e15c05=WriteIf(rsix51p15<=rsix515115 ,"On","Off");
e15c06=WriteIf(rsix1415<=50 ,"On","Off");
/////////////////////////////////////////////////////////////////////////////////////////////
TimeFrameSet(2*in15Minute);

rsi3430=RSI(34);
RSI34p30=RSI3430+(RSI3430*1/100);
rsi343430=EMA(Rsi3430,34);

rsi5130=RSI(51);
RSI51p30=RSI5130+(RSI5130*1/100);
rsi515130=EMA(Rsi5130,51);

rsi1430=RSI(14);
TimeFrameRestore();

rsix3430=TimeFrameExpand( rsi3430, 2*in15Minute,expandLast );
rsix34p30=TimeFrameExpand( rsi34p30, 2*in15Minute,expandLast );
rsix343430=TimeFrameExpand( rsi343430, 2*in15Minute,expandLast );
rsix5130=TimeFrameExpand( rsi5130, 2*in15Minute,expandLast );
rsix51p30=TimeFrameExpand( rsi51p30, 2*in15Minute,expandLast );
rsix515130=TimeFrameExpand( rsi515130, 2*in15Minute,expandLast );
rsix1430=TimeFrameExpand( rsi1430, 2*in15Minute,expandLast );

e30c01=WriteIf(rsix34p30>rsix343430 ,"On","Off");
e30c02=WriteIf(rsix51p30>rsix515130 ,"On","Off");
e30c03=WriteIf(rsix1430>50 ,"On","Off");

e30c04=WriteIf(rsix34p30<=rsix343430 ,"On","Off");
e30c05=WriteIf(rsix51p30<=rsix515130 ,"On","Off");
e30c06=WriteIf(rsix1430<=50 ,"On","Off");


////////////////////////////////////////////////////////////////////////////////////////////
TimeFrameSet(inHourly);

rsi34h=RSI(34);
RSI34ph=RSI34h+(RSI34h*1/100);
rsi3434h=EMA(Rsi34h,34);

rsi51h=RSI(51);
RSI51ph=RSI51h+(RSI51h*1/100);
rsi5151h=EMA(Rsi51h,51);

rsi14h=RSI(14);
TimeFrameRestore();

rsix34h=TimeFrameExpand( rsi34h, inHourly,expandLast );
rsix34ph=TimeFrameExpand( rsi34ph, inHourly,expandLast );
rsix3434h=TimeFrameExpand( rsi3434h, inHourly,expandLast );
rsix51h=TimeFrameExpand( rsi51h, inHourly,expandLast );
rsix51ph=TimeFrameExpand( rsi51ph, inHourly,expandLast );
rsix5151h=TimeFrameExpand( rsi5151h, inHourly,expandLast );
rsix14h=TimeFrameExpand( rsi14h, inHourly,expandLast );

ehc01=WriteIf(rsix34ph>rsix3434h ,"On","Off");
ehc02=WriteIf(rsix51ph>rsix5151h ,"On","Off");
ehc03=WriteIf(rsix14h>50 ,"On","Off");

ehc04=WriteIf(rsix34ph<=rsix3434h ,"On","Off");
ehc05=WriteIf(rsix51ph<=rsix5151h ,"On","Off");
ehc06=WriteIf(rsix14h<=50 ,"On","Off");

////////////////////////////////////////////////////////////////////////////////////////////
TimeFrameSet(4*inHourly);

rsi344h=RSI(34);
RSI34p4h=RSI344h+(RSI344h*1/100);
rsi34344h=EMA(Rsi344h,34);

rsi514h=RSI(51);
RSI51p4h=RSI514h+(RSI514h*1/100);
rsi51514h=EMA(Rsi514h,51);

rsi144h=RSI(14);
TimeFrameRestore();

rsix344h=TimeFrameExpand( rsi344h, 4*inHourly,expandLast );
rsix34p4h=TimeFrameExpand( rsi34p4h, 4*inHourly,expandLast );
rsix34344h=TimeFrameExpand( rsi34344h, 4*inHourly,expandLast );
rsix514h=TimeFrameExpand( rsi514h, 4*inHourly,expandLast );
rsix51p4h=TimeFrameExpand( rsi51p4h, 4*inHourly,expandLast );
rsix51514h=TimeFrameExpand( rsi51514h, 4*inHourly,expandLast );
rsix144h=TimeFrameExpand( rsi144h, 4*inHourly,expandLast );

e4hc01=WriteIf(rsix34p4h>rsix34344h ,"On","Off");
e4hc02=WriteIf(rsix51p4h>rsix51514h ,"On","Off");
e4hc03=WriteIf(rsix144h>50 ,"On","Off");

e4hc04=WriteIf(rsix34p4h<=rsix34344h ,"On","Off");
e4hc05=WriteIf(rsix51p4h<=rsix51514h ,"On","Off");
e4hc06=WriteIf(rsix144h<=50 ,"On","Off");

////////////////////////////////////////////////////////////////////////////////////////////
TimeFrameSet(inDaily);

rsi34d=RSI(34);
RSI34pd=RSI34d+(RSI34d*1/100);
rsi3434d=EMA(Rsi34d,34);

rsi51d=RSI(51);
RSI51pd=RSI51d+(RSI51d*1/100);
rsi5151d=EMA(Rsi51d,51);

//Plot(int(54.55),"",colorWhite);;
rsi14d=RSI(14);
TimeFrameRestore();

rsix34d=TimeFrameExpand( rsi34d, inDaily,expandLast );
rsix34pd=TimeFrameExpand( rsi34pd, inDaily,expandLast );
rsix3434d=TimeFrameExpand( rsi3434d, inDaily,expandLast );
rsix51d=TimeFrameExpand( rsi51d, inDaily,expandLast );
rsix51pd=TimeFrameExpand( rsi51pd, inDaily,expandLast );
rsix5151d=TimeFrameExpand( rsi5151d, inDaily,expandLast );
rsix14d=TimeFrameExpand( rsi14d, inDaily,expandLast );

edc01=WriteIf(rsix34pd>rsix3434d ,"On","Off");
edc02=WriteIf(rsix51pd>rsix5151d ,"On","Off");
edc03=WriteIf(rsix14d>50 ,"On","Off");

edc04=WriteIf(rsix34pd<=rsix3434d ,"On","Off");
edc05=WriteIf(rsix51pd<=rsix5151d ,"On","Off");
edc06=WriteIf(rsix14d<=50 ,"On","Off");

///////////////////////////display ////////////////////////////

Hor=Param("Signal X",600,1,667,1);
Ver=Param("Signal Y",35,30,450,1);

GfxSelectFont("Callibri", 10 , 700, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( colorGreen );
wfactor=Param("Move Signal",25,25,200,1);

GfxTextOut("26 / 52 Sig",Hor+wfactor-10, Ver+00);

GfxTextOut("01M ",hor+68+wfactor, Ver-15);
GfxTextOut("05M ",hor+112+wfactor, Ver-15);
GfxTextOut("15M ",hor+152+wfactor, Ver-15);
GfxTextOut("30M ",hor+192+wfactor, Ver-15);
GfxTextOut("01H ",hor+232+wfactor, Ver-15);
GfxTextOut("04H ",hor+272+wfactor, Ver-15);
GfxTextOut("24H ",hor+312+wfactor, Ver-15);


////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////// Signal for 26 52 in different time frame
/////////////////////////01
if(e01c01=="On" AND e01c02=="On" AND e01c03=="On")
GfxSelectSolidBrush(colorBrightGreen);
if(e01c04=="On" AND e01C05=="On" AND e01c06=="On")
GfxSelectSolidBrush(colorRed);
GfxSelectPen( colorLightGrey, 1 ); // broader color
GfxRectangle( Hor+065+wfactor,Ver+5,Hor+100+wfactor,Ver+20 );
/////////////////////////05
if(e05c01=="On" AND e05c02=="On" AND e05c03=="On")
GfxSelectSolidBrush(colorBrightGreen);
if(e05c04=="On" AND e05C05=="On" AND e05c06=="On")
GfxSelectSolidBrush(colorRed);
GfxSelectPen( colorLightGrey, 1 ); // broader color
GfxRectangle( Hor+109+wfactor,Ver+5,Hor+140+wfactor,Ver+20 );

/////////////////////////15
if(e15c01=="On" AND e15c02=="On" AND e15c03=="On")
GfxSelectSolidBrush(colorBrightGreen);
if(e15c04=="On" AND e15C05=="On" AND e15c06=="On")
GfxSelectSolidBrush(colorRed);
GfxSelectPen( colorLightGrey, 1 ); // broader color
GfxRectangle( Hor+149+wfactor,Ver+5,Hor+180+wfactor,Ver+20 );
////////////////////////30
if(e30c01=="On" AND e30c02=="On" AND e30c03=="On")
GfxSelectSolidBrush(colorBrightGreen);
if(e30c04=="On" AND e30C05=="On" AND e30c06=="On")
GfxSelectSolidBrush(colorRed);
GfxSelectPen( colorLightGrey, 1 ); // broader color
GfxRectangle( Hor+189+wfactor,Ver+5,Hor+220+wfactor,Ver+20 );
//////////////////////// 1h
if(ehc01=="On" AND ehc02=="On" AND ehc03=="On")
GfxSelectSolidBrush(colorBrightGreen);
if(ehc04=="On" AND ehC05=="On" AND ehc06=="On")
GfxSelectSolidBrush(colorRed);
GfxSelectPen( colorLightGrey, 1 ); // broader color
GfxRectangle( Hor+229+wfactor,Ver+5,Hor+260+wfactor,Ver+20 );
////////////////////// 4h
if(e4hc01=="On" AND e4hc02=="On" AND e4hc03=="On")
GfxSelectSolidBrush(colorBrightGreen);
if(e4hc04=="On" AND e4hC05=="On" AND e4hc06=="On")
GfxSelectSolidBrush(colorRed);
GfxSelectPen( colorLightGrey, 1 ); // broader color
GfxRectangle( Hor+269+wfactor,Ver+5,Hor+300+wfactor,Ver+20 );
/////////////// D
if(edc01=="On" AND edc02=="On" AND edc03=="On")
GfxSelectSolidBrush(colorBrightGreen);
if(edc04=="On" AND edC05=="On" AND edc06=="On")
GfxSelectSolidBrush(colorRed);
GfxSelectPen( colorLightGrey, 1 ); // broader color
GfxRectangle( Hor+309+wfactor,Ver+5,Hor+340+wfactor,Ver+20 );

rsi34=RSI(34);
RSI34p=RSI34+(RSI34*1/100);
rsi3434=EMA(Rsi34,34);

rsi51=RSI(51);
RSI51p=RSI51+(RSI51*1/100);
rsi5151=EMA(Rsi51,51);

rsi14=RSI(14);

Cond1=RSI34p>RSI34;
Cond2=RSI51p>RSI51;
Cond3=RSI14>50;

Cond4=RSI34p<=RSI34;
Cond5=RSI51p<=RSI51;
Cond6=RSI14<=50;

Buy = Cond1 AND Cond2 AND Cond3;
Sell = Cond4 AND Cond5 AND Cond6;

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

PlotShapes(shapeUpArrow*Buy,colorGreen,0,L,-12);
PlotShapes(shapeDownArrow*Sell,colorRed,0,H,-12);

AlertIf( Buy, "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 1 );

//AlertIf( Buy, "", "Buy", 1 );

AlertIf( Sell, "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2 );

//AlertIf( Sell, "", "Sell", 2 );

//==================================================
_SECTION_BEGIN("POPUP");//pop up alert




//Buy=MACD()>Signal();
//Sell = MACD()<Signal();
PlotShapes( IIf( Buy, shapeDownArrow + shapePositionAbove, shapeNone ), colorGreen );
//PopupWindow("Buy : " + FullName(),"Alert", 5, 640*mtRandom(), 480*mtRandom());



PlotShapes( IIf( Sell, shapeUpArrow + shapePositionAbove, shapeNone ), colorRed );
//PopupWindow("Sell : " + FullName(),"Alert", 5, 640*mtRandom(), 480*mtRandom());

_SECTION_END();

_SECTION_BEGIN("MA1");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
same time frame error signals are not same
_SECTION_BEGIN("MA2");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();


cx=Param("cxposn",850,0,1000,1);
cy=Param("cyposn",6,0,1000,1);

GfxSetBkColor(ColorRGB(200,50,300));
GfxSelectFont( "Bodoni MT",18,98, False);
GfxSetTextColor( colorWhite);
GfxTextOut(" "+C+" ", cx, cy );
 

Similar threads