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 was wondering if anyone could point me in the right direction here. I'm looking to code something that references the highest high or lowest low price of an open position.
I know there's
and then
, but the first references "x number of bars ago," and the 2nd references profit, not the "high/low price" of a currently open position.
Any advice or tips would be greatly appreciated! Much thanks - Brandon
Can you help answer these questions from other members on NexusFi?
you could convert the MaxPositionProfit back to a price value for example, as you know the point value of the symbol, your position size and the entry price for each trade. This could become problematic in case you scale in and out of positions.
In that case you would have to track the high your self with a variable. You would have to reset the variable when you are flat or once at the beginning of each trade. Then while you are in a trade and every time the high is higher than the value stored in your variable, you would update the variable to store the high.
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals, U308 and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,060 since Dec 2013
Thanks Given: 4,410
Thanks Received: 10,230
Alternatively have a bar counter, every time you enter a trade/send a market order reset the counter, and then just calculate highest(high,barcounter)?
Just to revisit this idea, would making the "Highest High or Lowest Low" of a position a variable work? Below is meant to show the Highest or Lowest price of an open position.
you could check if using BarsSinceEntry instead of the EntryPrice will give you what you are looking for.
Regards,
ABCTG
Just back to revisit this idea!
So I wrote a variable to make my "Highest High" and "Lowest Low." I did this because I don't want a limitation as to how many bars back it'll reference ( ie, Highest (H, bars back) ;
Here's what I have below. It doesn't seem to be working as I expected and wanted to get some feedback if you guys have the time!
Variables:
io_HighestHigh (0),
io_LowestLow (0);
IF MarketPosition = 0 THEN BEGIN // this is to reset the variable as it's not used to enter into a position
io_HighestHigh = 0 ;
io_LowestLow = 0 ;
END ;
IF MarketPosition <> 0 THEN BEGIN
io_HighestHigh = H of data1 ;
io_LowestLow = L of data1 ;
IF H of data1 > io_HighestHigh then io_HighestHigh = H of data1 ;
IF L of data1 < io_LowestLow then io_LowestLow = L of data1 ;
END ;