How do I plot a line for current high and low of the week that only changes at the end of the daily close, specifically for forex market - pine-script-v5

I want to plot a line that shows the previous day high and low... And also the current week high and low, however I want the current week to only change once the forex market close by the end of the day to accommodate for the marginal new highs and lows created during the trading day. The current script I have changes as new marginal highs and lows are created during the day. Thanks
I edit a script written by someone but unfortunately couldn't find my way around it on how to keep the current week high and low from changing during the day as trading range expand for marginal new highs and lows.

Related

Timeplot to show the sum of model units

I am working on a system dynamics model, whose units are days, in AnyLogic. The model tracks daily demand of water for 10,950 days (30 years). One of the model’s outputs is a timeplot that keeps track of this demand, but I don’t want it to plot the daily demand. Instead, I want the timeplot to show demand in years (i.e. the sum of 365 days across the 30 years). I am having a bit of trouble finding a way to do this and would appreciate any help. Thank you!
I assume your problem is twofold.
How to get the time plot to display 30 years of data
How to sum the annual demand for 30 years
Here is a simple example that I believe answers your question.
In this simple model, there is a daily event that simulates the daily demand, and adds it to a variable called annualDemand
There is another event that runs yearly and tasks the annualDemand and saves it to a data set, and rests the annual demand accumulator to 0.
In your time plot, you simply display the dataset which will at the end of the model only contain 30 entries, one for each year.
By following the same principles
Save annual demand
yearly event to add annual demand to data set and reset the annual demand
time plot to plot the dataset
You should be able to get what you need.

Training year transition

enter image description hereI am hoping that someone can help me with the below problem.
I am trying to create a field in a database to indicate the date that a trainee will move to thier next year of training. They go to next year of training after 52 weeks training. They may have multiple placements during a particular training year.
I have their training start date (trainee::startdate... their start and end date (traineeplacement::startdate and traineeplacement::enddate) of each job (in a linked table), their percentage of full time (traineeplacement::PercentageFullTime) and the calculated number of weeks whole time equilavent in the job (traineeplacement::durationweeks).
Through using the cumulative time in a training (traineeplacement::training-duration), in excel I can find the end of the block before using Max statment with an imbedded if statement to find max value less than 52 weeks in cumulative time in training. I cannot seem to do this in filemaker. I would then like to find the next line in the traineeplacement table and from that I can calculate the end of training year date from start of placment date, % of fulltime, and number of weeks neediing to be worked to get to 52 weeks...
The placements are measured in weeks for ease and training runs over a minimum of 4 years, calculated from start and end dates of each placement. The placement dates are a consecutive, but I will only count the product of weeks worked and % of full time (full time =100%, not working (e.g. maternity leave) = 0%). Hope this makes sense and I have included a screen shot of the draft of the database to give you an idea of what I mean.
I hope this makes sense.
enter image description here
Excel spreadsheet
Excel Spreadsheet Formulae

filtering units out of a sum based on dwell time

I am trying to create a viz showing the financial impact of having trucks sit on the lot for extended periods of time. At the top, I have individual blocks of relevant information (current year sales/ previous year sales/ current year gross margin/ previous year gross margin etc).
Anyway, these blocks are calculated by Count() and Sum() functions.
I want to add a sliding filter of 'days on the lot' that would change these numbers accordingly. Is there a way to keep the summed figures and have them change by excluding trucks based on dwell time?

Dymola / Modelica - District heating

I am trying to validate a district heating model I built using Dymola.
In this case, I am trying to find the mass flow during a year period. I have two models running. both with the same loads and pipes with same characteristics as this picture:
pipes
Both models are as follows:
models
My results are making sense at least regarding the time of the year my flow should be higher, I am getting very high values during January, February and March, then again by the end of the year.
However those high peaks are VERY different, the first model on the picture is giving me peaks of almost 400kg/s whereas the second one is reaching up to 70kg/s.
Can anyone suggest a way to validate the model? I have the heat loads for the year hour by hour (this is the input I am giving to Dymola), I know that the min temperature of the water is 70 and the max is 85 celsius.
But I am really struggling to validate my model. Any suggestions?

Find and Rank Time Series MATLAB

I know there must be a simple way that I can learn to do this but I cannot imagine how to start. I am tasked with finding a top 10 matching daily wind power time series in a 30-day plus/minus window from the first day in the time series (Jan 1st) matching a single daily wind power time series and it is out of my level of experience in MATLAB. I have successfully done this matching a single time series of the current year with the exact calendar days from previous years, but I need a more robust searching method to find the best correlated time series in a +/- window of time. For example, I'm comparing a 120 day time series (without leap years) with 25 previous years during the same 120-day period (Jan-Apr). The end result will show me the top 10 time series with the years and Julian day or cumulative day listed and a correlation or RMSE value associated with it. My data looks like this arranged in a 365 (days) X 25 (years) array and I thank you very much for your help!
1182573 470528 1638232 2105034 1070466 478257 1096999
879997 715531 1111498 1004556 1894202 1372178 1707984
636173 937769 2119436 742710 1625931 1275567 1228515
967360 1103082 2218855 1643898 1822868 554769 1325642