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)
I'm very new to EasyLanguage, this is my first ever attempt at programming but I'm stuck.
I'm trying to get a counter working so i only enter the market once per signal, not with every tick, when IOG is switched on. I've tried adding a counter function to long trades but I'm still having multiple entries. Could any of you tell me where I'm going wrong? Thanks
Can you help answer these questions from other members on NexusFi?
I would suggest that you take a look at the reserved word print. This allows you to print internal study values to the output / print log and can help you tremendously in finding out what is going on within your code.
In your case I'd check the value that count holds at the beginning, before you increment it and maybe at the end of the code.
First, You give 1 contracts on trade per Execute on signal,
but you allow more than 1 contracts on Property,
thus, IOG on will give more trade within Same bar.
RightClick -> Format Signal -> Properties... -> Position limit (Uncheck) Allow add to 10 entry orders in the same xxx
Besides, for coding, you add additional Checking:
if XXX and barssinceentry > 1 then to avoid extra entry within the same bar
Oh Sorry, as you use limit order, it is NOT yet execute and throw the entry out IOG.
barssinceentry > 1 fail to skip extra orders.
New variable to carry BarNumber and NOT to throw order again within the same bar:
variable: LastOrderBarNumber(0);
If LongEntry = True and count < 2 and LastOrderBarNumber <> BarNumber then // Records limit, profit, and stop prices and places an order
begin
LimitPrice = Lowest(low,HighestLowestRange);
TargetPrice = LimitPrice + (ProfitTarget * Ticsize);
StopPrice = LimitPrice - (StopLoss * Ticsize);
Buy("entryL") lots contracts next bar at LimitPrice limit;
count = count + 1; LastOrderBarNumber = BarNumber;
end;
Thanks a lot, i think i understand a bit better now.
On another note, I'm trying to manage a position once i've been filled. So essentially i want to move my profit target if three bars have passed since I've been in the trade. This is the code I've come up with, it doesn't seem to be doing the what i expect. IOG is false.
so what its meant to do is, when a limit order is filled it places a stop and a profit target. Three bars after entry, it then should move the profit target to entry(to scratch the trade). Leaving the stop where it is.
What it actually does is the first part, it just places the stop and profit target once the position is opened. The second part of the code doesn't do anything.
check what values "currentbar" and "barnum" actually hold. The print reserved word could be helpful here, too.
On a separate matter the build in stop/target related reserved words should not be placed within conditional statements as this can impact their behavior.