Menu
Brokers
MT4 Forex Brokers
MT5 Forex brokers
PayPal Brokers
Skrill Brokers
Oil Trading Brokers
Gold Trading Brokers
Web Browser Platform
Brokers with CFD Trading
ECN Brokers
Bitcoin FX Brokers
PAMM Forex Brokers
With Cent Accounts
With High Leverage
Cryptocurrency Brokers
Forums
All threads
New threads
New posts
Trending
Search forums
What's new
New threads
New posts
Latest activity
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Reply to thread
Forums
Trading Platforms
MetaTrader Expert Advisors
PSAR EA code problem
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
[QUOTE="ezraluandre, post: 202539, member: 67482"] Hi guys, I create a basic EA to send a buy or sell signal depending where there is a reversal on parabolic SAR indicator. When I tried to use this code the result on strategy tester is not working, [CODE=mql4]int CheckOpenPosition(int shift=0) { int result=0; if(sar(1)>Open[1] && sar()<Open[0]) result=1; if(sar(1)<Open[1] && sar()>Open[0]) result=2; return result;[/CODE] but when I use this code it is working [CODE=mql4]int CheckOpenPosition(int shift=0) { int result=0; if(sar(2)>Open[2] && sar(1)<Open[1]) result=1; if(sar(2)<Open[2] && sar(1)>Open[1]) result=2; return result;[/CODE] the only difference between the first code and the second is that the second code using shift of 2 shift and 1 shift and where the first code using shift of 0 shift and 1 shift. Anyone knows why the second code is working while the first code isn't while the difference is only on the shift? *if the code is working properly the result on strategy tester should like "sar with 2 & 1 shift" attachment. And "sar with 1 & 0 shift" attachment is the result of the first code. [/QUOTE]
Insert quotes…
Verification
Post reply
Top
Bottom
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…