Help me?
@erahul99, you are comparing a NUMBER (returned from ParamToggle()) to a STRING returned from ParamList().
A possible solution:
C_DownTrend = True;
C_UpTrend = True;
trendRule1 = ParamToggle( "SMA50", "ON|OFF", 1 );
trendRule2 = ParamToggle( "SMA50,SMA200", "ON|OFF", 1 );
trendRule = ParamToggle( "Detect trend with Rule1|Detect trend with Rule2", "ON|OFF", 1 );
if( trendRule == trendRule1 )
{
priceAvg = MA( Close, 50 );
C_DownTrend = Close < priceAvg;
C_UpTrend = Close > priceAvg;
}
// rest of code
Still, I wonder why you are doing it in this way and not simply using a single ParamToggle().
trendRule = ParamToggle( "Detect trend with SMA50|Detect trend with SMA50, SMA200", "ON|OFF", 1 );
if( trendRule == 0 )
{
// Your code to detect the trend using only SMA50
}
else
{
// Your code to detect the trend using both SMA50 and SMA200
}
1 Like
Thanks sir for help me I am new to amibroker.
This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.