Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
I'm trying to figure out if this is wrong;
for (int i=qqea_alert_x_candles_ago; i>0; i--) {
// int i = 1;
qqea_up = iCustom(NULL,0,"QQE Alert v3",0,i);
qqea_down = iCustom(NULL,0,"QQE Alert v3",1,i);
if (qqea_up < qqea_down) {
if (i == 1) qqeacross = True;
qqea_long = True;
qqea_short = False;
} else if (qqea_up > qqea_down) {
if (i == 1) qqeacross = True;
qqea_long = False;
qqea_short = True;
}
}
}
it should check for valid signal upto "qqea_alert_x_candles_ago" bars back, but then it has (i == 1) which i==1 only happens once ??
for (int i=qqea_alert_x_candles_ago; i>0; i--) {
// int i = 1;
qqea_up = iCustom(NULL,0,"QQE Alert v3",0,i);
qqea_down = iCustom(NULL,0,"QQE Alert v3",1,i);
Print("qqea_up: ", qqea_up, "qqea_down: ", qqea_down);
if (qqea_up < qqea_down) {
if (i == 1) qqeacross = True;
qqea_long = True;
qqea_short = False;
} else if (qqea_up > qqea_down) {
if (i == 1) qqeacross = True;
qqea_long = False;
qqea_short = True;
}
}
}
it should check for valid signal upto "qqea_alert_x_candles_ago" bars back, but then it has (i == 1) which i==1 only happens once ??
At face value your code looks alright, that is assuming "qqea_alert_x_candles_ago" > 0.
Your problem if this is not working is more than likley in relation to iCustom.
For this function to work correctly you need to pass an input element for every input element in the actual indicator. If you don't do this, or pass the wrong data types then icustom will return nothing.
I have added a Print statement into the code above. Use this to determine if the values returned from iCustom actually contain anything.
The problem I have is that I want the value of StopLossBars to increase with every bar counted since the position was opened until one of my other conditions for stoploss over rides this condition. I guess a line of code such as:
At face value your code looks alright, that is assuming "qqea_alert_x_candles_ago" > 0.
Your problem if this is not working is more than likley in relation to iCustom.
For this function to work correctly you need to pass an input element for every input element in the actual indicator. If you don't do this, or pass the wrong data types then icustom will return nothing.
I have added a Print statement into the code above. Use this to determine if the values returned from iCustom actually contain anything.
Cheers,
Hiachiever
The code is from another EA but I was thinking that when the loop goes to "qqea_alert_x_candles_ago" > 1 then this statement "if (i == 1) qqeacross = True;" would be False now, correct? When it should stay True until i>qqea_alert_x_candles_ago.
I got this coding from a colleague. He told me, that should be a very good Indicator signaling SMA up or down entries. Can somebody help me to create an indicator with this coding below.
/*[[
Name := SMA Up and Down
Separate Window := no
First Color := Blue
First Draw Type := Line
Use Second Data := Yes
Second Color := Red
Second Draw Type := Line
]]*/
Inputs : MAPeriod(10), Bandwide_UP(20),Bandwide_DOWN(20);
Variables : shift(0), cnt(0), sum(0), loopbegin1(0), loopbegin2(0), first(True), prevbars(0);
Variables : MA(0);
SetLoopCount(0);
// initial checkings
If MAPeriod < 1 Then Exit;
// check for additional bars loading or total reloading
If Bars < prevbars Or Bars-prevbars>1 Then first = True;
prevbars = Bars;
// loopbegin1 and loopbegin2 prevent couning of counted bars exclude current
If first Then Begin
loopbegin1 = Bars-MAPeriod-1;
If loopbegin1 < 0 Then Exit; // not enough bars for counting
loopbegin2 = Bars-MAPeriod-1;
If loopbegin2 < 0 Then Exit; // not enough bars for counting
first = False; // this block is to be evaluated once only
End;
// convergence-divergence
loopbegin1 = loopbegin1+1; // current bar is to be recounted too
For shift = loopbegin1 Downto 0 Begin
MA = iMA(MAPeriod,MODE_SMA,shift);
SetIndexValue(shift,(MA+Bandwide_UP*point));
SetIndexValue2(shift,(MA-Bandwide_DOWN*point));
loopbegin1 = loopbegin1-1; // prevent to previous bars recounting
End;