Here's a Trading System Idea
my question is mostly about suggestion re: usage of string( because even though I just want to plot a label in the end, perhaps calculation could be faster/better
..so, if I use doubles, is it better?
//TREND double MonthlyTrend = iMA(NULL,PERIOD_H4,200,0,0,0,0); double WeeklyTrend = iMA(NULL,PERIOD_H1,200,0,0,0,0); double DailyTrend = iMA(NULL,PERIOD_M15,200,0,0,0,0); //IMPULSE double MonthlyImpulse = iRSI(NULL,PERIOD_H4,20,0,0); double WeeklyImpulse = iRSI(NULL,PERIOD_H1,20,0,0); double DailyImpulse = iRSI(NULL,PERIOD_M15,20,0,0); //DRIFT double MonthlyDrift = iMACD(NULL,PERIOD_H4,3,8,5,0,0,0); double WeeklyDrift = iMACD(NULL,PERIOD_H1,3,8,5,0,0,0); double DailyDrift = iMACD(NULL,PERIOD_M15,3,8,5,0,0,0); //=============== /**/ //================= if (price > WeeklyTrend){ if ((WeeklyImpulse>=50) && (WeeklyDrift>=0)) {WeeklyBias="BUY";}} else if (price < WeeklyTrend){ if ((WeeklyImpulse<=50) && (WeeklyDrift<=0)) {WeeklyBias="SELL";}} //================== /**/ //=================== PlotLabel(NULL,"MonthlyBias",0,17,17,1,"Month - "+MonthlyBias); PlotLabel(NULL,"WeeklyBias",0,17,34,1,"Week - "+WeeklyBias); PlotLabel(NULL,"DailyBias",0,17,51,1,"Day - "+DailyBias); return(0); }
Hello,
My Trading System Idea is the following -
- look to buy if the Bias is "BUY" and look to sell if the Bias is "SELL", pretty obvious, in general.
How to go about executing the buy/sell orders is a different story because the current story is about figuring out this aforementioned Bias. How do I choose? So, to move along I decided that I will use a Duration for which my bias shall be established and the bias itself will just be price-based, so essentially, a just-look-at-the-chart kind of research.
More to the point, though...So, I take three durations: Monthly Duration, Weekly Duration, and Daily Duration and I want to open a chart with an indicator that just plots me a Label which says:
Monthly -BUY/SELL
Weekly - BUY/SELL
Daily - BUY/SELL
...now, how to decide the above? ...not to make it too hard, I just figured I'll use a 200 moving average for Trend, a 50 level in RSI for Impulse and the 0-line of the MACD for Drift.
...the logic is the following, I want price to be on the right side of Trend (right side is verified by Impulse above/below 50) and Drift in the direction of Trend (verified by the side MACD's on)
so I did the following...
...so the indicator plots the label calling out the bias for given Duration.
...the way in which Monthly/Weekly/Daily Bias is determined is,
...having declared Trend, Impulse, and Drift in the following way
I do this (weekly example)
and everything seems to work fine, except I feel its ugly coding and I want to improve it, what would you suggest
ps. here's the whole bias_label indicator