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 trying to test a strategy that buys broken pivot levels.
I have the entries working fine, but I am having a very tough time getting the code to allow one trade per setup.
I've attempted to create a variable called buyflag, and when a trade is placed I set it equal to the buy_level_one (broken pivot high). This seems to work in that it allows only one buy, and I would imagine that I'd need to create thousands of these in order to test it over time.
I'm sure there's a simpler way to do this, for example maybe reference the most recent limit price, and I can check for that when placing the trade?
I'm very new to easylanguage and have been banging my head against a wall for a while on this and thought I'd ask for help.
Here's an example of the entry code:
Can you help answer these questions from other members on NexusFi?
Try this before your order EntriesToday(date) = 0 if you want to only allow one trade a day and if you want to make sure its not taking the trade at the same level as before reference the previous entry price.
Try this before your order EntriesToday(date) = 0 if you want to only allow one trade a day and if you want to make sure its not taking the trade at the same level as before reference the previous entry price.
if EntryPrice(1) = buy_level_one then no trade!
Thanks for the suggestion, I'll mess around with this. I typically do only take one trade per day with this when I trade manually.
Cool dog btw!
edit: also that entryprice reserved word also may work perfectly.
You also can add this filter if you want to open only once a day
//long entry
if
buyflag <> buy_level_one and
buy_level_one > 0 and
close > buy_level_one and
time > starttime and
Closed_Daily <> CloseD(1) and
time < endtime then begin
buy next bar tradesize contracts buy_level_one+(buffer) limit;
buyflag = buy_level_one;
Closed_Daily = CloseD(1);
end;
Another option if you want more than 1 trade per day, but only once at a given level might be to add a counter. (caveat, not sure the code below would work without knowing more fully how your entire code operates, so think of it conceptually more than anything)
//long entry
if
buyflag <> buy_level_one and
buy_level_one > 0 and
close > buy_level_one and
time > starttime and
Closed_Daily <> CloseD(1) and
buy_level_one_counter = 0 and
time < endtime then begin
buy next bar tradesize contracts buy_level_one+(buffer) limit;
buyflag = buy_level_one;
Closed_Daily = CloseD(1);
buy_level_one_counter = buy_level_one_counter [1] + 1;
end;