Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Your above code is still not a SSCCE: it does not compile. I have reconstructed something by adding the first lines (inputs, variables, indicators calculation) of your initial code.
It is normal that your first trade never close, since the exit conditions are within a "if CurrentContract = 1", whereas, when in position, CurrentContract is equal to 300000.
So I tried your suggestion and changed the "if CurrentContract = 1" to "if CurrentContract =100000" but it still doesn't work. Here is my code (it should compile just fine now):
if MyMACD > MACDAvg and MyMACD <= 0 and MACDAvg <= 0 then begin
Buy ("Enter Long1") 100000 contract next bar at market;
end;
end;
// Manage open orders
if MarketPosition = 100000 then begin
st1 = EntryPrice - (StopSize * TickSize);
if CurrentContracts = 100000 then begin
Sell ("Exit l1-c1 Target") 100000 contracts Next Bar at (EntryPrice + t1) Limit;
Sell ("Exit l1-c1 Stop") 100000 contracts Next Bar at st1 Stop;
end;
end;
I am so confused! The exit should be with the targets, right? Suggestions are very welcome... :-/
I don't know what you're talking about...? This is in the EasyLanguage Programming section of this forum, so those who can read the code are those who have platforms that use EL... What is this "code tag" that you're referring to?
I've been working on getting this strategy coded in my spare time. This last weekend I was finally able to code it so that my "buys" were entered/exited, but I couldn't get my "sells" to enter or exit. I figured out why the sells were failing to execute, but now I'm getting the syntax error
I've searched high and low on the internet for solutions (or even descriptions of why it's doing this), but I have had no luck. It seems like an easy issue to fix. Can someone help, please? Here is my code:
Any suggestions will be very appreciated! I've been staring at this code for a couple of hours now...