NexusFi: Find Your Edge


Home Menu

 





Preventing limit orders to be taken at the same price on the next bar


Discussion in EasyLanguage Programming

Updated
    1. trending_up 439 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

Preventing limit orders to be taken at the same price on the next bar

  #1 (permalink)
thinkorn00b
stavanger
 
Posts: 19 since Sep 2020
Thanks Given: 1
Thanks Received: 1

I have a code that takes multiple limit orders over several bars. The problem is that it doesn't store the entry price of the orders that executes, so it takes the same limit order on the next bar, instead of taking a lower limit order, or neglect the limit order if it doesn't come down the price.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Are there any eval firms that allow you to sink to your …
Traders Hideout
Better Renko Gaps
The Elite Circle
NexusFi Journal Challenge - April 2024
Feedback and Announcements
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
60 thanks
Funded Trader platforms
43 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #2 (permalink)
abev
seattle washington
 
Posts: 75 since Feb 2019
Thanks Given: 11
Thanks Received: 29

Nope, the strategy does not store the entry price unless you create a variable for it, store the value to the variable, and query the value of the variable to compare it to the potentially new entry price. lol - yeah you have some additional code to create to make it work.

Reply With Quote
  #3 (permalink)
thinkorn00b
stavanger
 
Posts: 19 since Sep 2020
Thanks Given: 1
Thanks Received: 1


Hi, thanks for the answer. Yes I know it doesn't store the price. However I got it to work by checking the number of contracts that the strategy have taken, and then disabling the limit prices based on that. Ex:

 
Code
if currentcontracts = 0 then
begin
    EntryLimit1 = true;
    EntryLimit2 = true;
    EntryLimit3 = true;
    EntryLimit4 = true;
 end
else if currentcontracts = 1 then
begin
    EntryLimit1 = false;
    EntryLimit2 = true;
    EntryLimit3 = true;
    EntryLimit4 = true;
end
else if currentcontracts = 2 then
begin
    EntryLimit1 = false;
    EntryLimit2 = false;
    EntryLimit3 = true;
    EntryLimit4 = true;
end
else if currentcontracts = 3 then
begin
    EntryLimit1 = false;
    EntryLimit2 = false;
    EntryLimit3 = false;
    EntryLimit4 = true;
end;
end;

if entrysignal then
begin
    if EntryLimit1 then Buy("BuyLimit1") 1 contract next bar at PivotLowPrice * (1 + (EntryPercentageAbovePivotLow * 0.0001)) limit;
    if EntryLimit2 then Buy("BuyLimit2") 1 contract next bar at PivotLowPrice * (1 + (EntryPercentageAbovePivotLow * 0.00008)) limit;
    if EntryLimit3 then Buy("BuyLimit3") 1 contract next bar at PivotLowPrice * (1 + (EntryPercentageAbovePivotLow * 0.00006)) limit;
    if EntryLimit4 then Buy("BuyLimit4") 1 contract next bar at PivotLowPrice * (1 + (EntryPercentageAbovePivotLow * 0.00004)) limit;
end;

Reply With Quote
  #4 (permalink)
abev
seattle washington
 
Posts: 75 since Feb 2019
Thanks Given: 11
Thanks Received: 29

Nice! I'd not have thought of doing it that way but I like it -- simple and straight forward.

Reply With Quote




Last Updated on April 27, 2023


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts