You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello
I have been attempting to convert a few line of VT code to MQL4 but have become stuck on the following.
the yellow section is the part I am having trouble with.
I think it means if the criteria onNodemand4 is met and NoDemand2 is not then signal is ok.
there are 30 sets of criteria to meet this is just an example.
NoDemand:=If(H>ref(H,-1) and L>=ref(L,-1) and (H-L)<=ref((H-L),-1) and V<ref(V,-1) and V<ref(V,-2) and C>ref(C,+1) and H>=ref(H,+1),1,0);
NoSupply:=If(L<ref(L,-1) and H<=ref(H,-1) and (H-L)<=ref((H-L),-1) and V<ref(V,-1) and V<ref(V,-2) and C<ref(C,+1) and L<=ref(L,+1),1,0);
NoDemand2:=If(H>ref(H,-1) and L>=ref(L,-1) and (H-L)>ref((H-L),-1) and C=O and C>ref(C,+1) and H>=ref(H,+1) and V<ref(V,-1) and V<ref(V,-2),1,0);
NoSupply2:=If(L<ref(L,-1) and H<=ref(H,-1) and (H-L)>ref((H-L),-1) and C=O and C<ref(C,+1) and L<=ref(L,+1) and V<ref(V,-1) and V<ref(V,-2),1,0);
NoDemand3:=If(H>ref(H,-1) and L>=ref(L,-1) and (H-L)>ref((H-L),-1) and C=H and C>ref(C,+1) and H>=ref(H,+1) and V<ref(V,-1) and V<ref(V,-2) and NoDemand2=0,1,0);
NoSupply3:=If(L<ref(L,-1) and H<=ref(H,-1) and (H-L)>ref((H-L),-1) and C=L and C<ref(C,+1) and L<=ref(L,+1) and V<ref(V,-1) and V<ref(V,-2) and NoSupply2=0,1,0);
NoDemand4:=If(H>ref(H,-1) and L>=ref(L,-1) and (H-L)>ref((H-L),-1) and C=((H-L)*0.5)+L and C>ref(C,+1) and H>=ref(H,+1) and V<ref(V,-1) and V<ref(V,-2) and NoDemand2=0,1,0);
NoSupply4:=If(L<ref(L,-1) and H<=ref(H,-1) and (H-L)>ref((H-L),-1) and C=((H-L)*0.5)+L and C<ref(C,+1) and L<=ref(L,+1) and V<ref(V,-1) and V<ref(V,-2) and NoSupply2=0,1,0);
NoDemand5:=If(H>ref(H,-1) and L>=ref(L,-1) and (H-L)>ref((H-L),-1) and C=L and C>ref(C,+1) and H>=ref(H,+1) and V<ref(V,-1) and V<ref(V,-2) and NoDemand2=0,1,0);
NoSupply5:=If(L<ref(L,-1) and H<=ref(H,-1) and (H-L)>ref((H-L),-1) and C=H and C<ref(C,+1) and L<=ref(L,+1) and V<ref(V,-1) and V<ref(V,-2) and NoSupply2=0,1,0);
NoDemand6:=If(C>ref(C,-1) and (H-L)<ref((H-L),-1) and C>ref(C,+1) and H>=ref(H,+1) and V<ref(V,-1) and V<ref(V,-2)and NoDemand=0,1,0);
NoSupply6:=If(C<ref(C,-1) and (H-L)<ref((H-L),-1) and C<ref(C,+1) and L<=ref(L,+1) and V<ref(V,-1) and V<ref(V,-2)and NoSupply=0,1,0);
below is my conversion
if(H>H1 && L>=L1 && H-L<=H1-L1 && V<V1 && V<V2 && C>C+1 && H>=H+1) NoDemand = true;
if(L<L1 && H<=H1 && H-L<=H1-L1 && V<V1 && V<V2 && C<C+1 && L<=L+1) NoSupply = true;
if(H>H1 && L>=L1 && H-L>H1-L1 && C==O && C>C+1 && H>=H+1 && V<V1 && V<V2)NoDemand2 = true;
if(L<L1 && H<=H1 && H-L>H1-L1 && C==O && C<C+1 && L<=L+1 && V<V1 && V<V2)NoSupply2 = true;
if(H>H1 && L>=L1 && H-L>H1-L1 && C==H && C>C+1 && H>=H+1 && V<V1 && V<V2 && (NoDemand2==false))NoDemand3 = true;
if(L<L1 && H<=H1 && H-L>H1-L1 && C==L && C<C+1 && L<=L+1 && V<V1 && V<V2 && NoSupply2==false)NoSupply3 = true;
if(H>H1 && L>=L1 && H-L>H1-L1 && C==H-L*0.5+L && C>C+1 && H>=H+1 && V<V1 && V<V2&& NoDemand2==false)NoDemand4 = true;
if(L<L1 && H<=H1 && H-L>H1-L1 && C==H-L*0.5+L && C<C+1 && L<=L+1 && V<V1 && V<V2 && NoSupply2==false)NoSupply4 = true;
if(H>H1 && L>=L1 && H-L>H1-L1 && C==L && C>C+1 && H>=H+1 && V<V1 && V<V2 && NoDemand2==false)NoDemand5 = true;
if(L<L1 && H<=H1 && H-L>H1-L1 && C==H && C<C+1 && L<=L+1 && V<V1 && V<V2 && NoSupply2==false)NoSupply5 = true;
if(C>C1 && H-L<H1-L1 && C>C+1 && H>=H+1 && V<V1 && V<V2 && NoDemand==false)NoDemand6 = true;
if(C<C1 && H-L<H1-L1 && C<C+1 && L<=L+1 && V<V1 && V<V2 && NoSupply==false)NoSupply6 = true;
Any help would be great.
Cheers Kiwi