Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
The previous day's one-minute decision
Collapse
X
-
Thank you for your reply.
The sample code in the second link you sent me (I think it says something like Print("This is a message")) outputs, but how do I get the output for the program I am currently creating?
Comment
-
Comment
-
Hello ラリー
From the image you have some prints in OnBarUpdate. That is how you can add prints to your script. You can change what you are printing to whatever is relevant to help you better understand the script. If you wanted to print a value you would replace the code inside the ( and ) to output that instead.
The help guide is just an example, all help guide examples expect that you will change it to suit your needs.
Comment
-
Thank you for your reply.
I have replaced the code (currentDayValue) and output to the print log, but it seems that only the result of the calculation for the currentDayValue is output, but the calculation for the entire program (MyCustomIndicatorPrevioushigh) I wanted to print out the result of the entire program (MyCustomIndicatorPrevioushigh), so I replaced currentDayValue with MyCustomIndicatorPrevioushigh, but I replaced the operator '+' with 'string ' and cannot be applied to the operand of a method group. I get an error message that says '+' cannot be applied to 'string' and the operand of a method group.
How can I do this?
Comment
-
Hello
Right, if that is what you put in the print that would be all that is output. You can configure the print to output whatever data you wanted to.I have replaced the code (currentDayValue) and output to the print log, but it seems that only the result of the calculation for the currentDayValue is output,
MyCustomIndicatorPrevioushigh is the name of your script, that is not a variable you could print. The items you can print are what you see in OnBarUpdate.but the calculation for the entire program (MyCustomIndicatorPrevioushigh) I wanted to print out the result of the entire program (MyCustomIndicatorPrevioushigh)
You would also need to move the prints to later in OnBarUpdate, the variables are being set after the print so the print will not show what values were set when OnBarUpdate is run.
Comment
-
Thank you for your reply.
Am I correct in understanding that if I specify Print(currentDayValue), then all the calculation results described after OnBarUpdate will be output to NinjaScript Output?
When the NinjaScript calculation results are applied to a chart, MyPlot2 in the data box shows a value of 0 at 14:50, but the output of NinjaScript Output shows -1, which is different from the results output to NinjaScript Output. Why is this different from the result output in NinjaScript Output?
Comment
-
Hello ラリー,
Correct.Am I correct in understanding that if I specify Print(currentDayValue), then all the calculation results described after OnBarUpdate will be output to NinjaScript Output?
The data box shows the value where the mouse cursor is located or the current value when the mouse is not over the chart. The output window shows all prints in chronological order.When the NinjaScript calculation results are applied to a chart, MyPlot2 in the data box shows a value of 0 at 14:50, but the output of NinjaScript Output shows -1, which is different from the results output to NinjaScript Output. Why is this different from the result output in NinjaScript Output?
The reason this is 0 is because you have added a new conditions at line 69 and 74 which is resetting the value to 0, that was not part of the original sample that I had provided. The conditions checking for Close less than Open or Close greater than Open are where you would need time conditions if you wanted to limit that to a specific time.
Comment
-
Thank you for your reply.
I changed the code once to the code you sent us in post 2 and changed it from print(currentDayValue ) to print(Value[0]) and the result applied to the chart and the result output to NinjaScript Output seemed to be the same, and the printing The printing problem seems to have been resolved (attached).
However, as for the session judgment, which was my first question, I have tried various methods, but they do not work, and the judgment is not based on the opening price at which the first trade started, and I am not sure if I understand it correctly or not.
I would appreciate it if you could share the code in a ZIP file (including all the code) if possible, as I do not understand it well and I apologize for any inconvenience.
Comment
-
Hello ラリー,
We have covered the attempts that you tried, most of the changes you made were not correct so that changes how the basic example that I provided works. For what you are asking you need to add time conditions where the -1 or 1 are being set. Our support cannot create code for you but we can provide basic examples like we had already,However, as for the session judgment, which was my first question, I have tried various methods, but they do not work,
After you reverted the code the time conditions would need to be combined with lines 79 and 84.
Code:if(Close[0] < Open[0] && timeConditionHere) { CurrentDayValue = -1; } else if(Close[0] > Open[0] && timeConditionHere) { CurrentDayValue = 1; }
Comment
-
Thank you for your reply.
I have changed NinjaScript as attached, is this correct?
Also, am I correct in understanding that the code from line 62 to 67 and from line 69 to 72 are required, and the code from line 79 to 87 is for determining whether the 1 minute leg is rising or falling?
I also got an error that timeConditionHere does not exist in the current context.
Comment
-
Hello ラリー,
It looks like you had copied the placeholder text rather than making your own time condition. In the last post I just pointed out where you need to place time conditions, I did not include any time conditions. You can see the following help guide link for examples of how to make a time condition.
Comment
-
Thank you for your reply.
I was aware that I was supposed to copy the code from post 41, but I see that is not the case.
If so, the code description in post 41, if(Close[0] < Open[0] &&timeConditionHere), does it mean that we replace the time condition with timeConditionHere here?
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
668 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
377 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
110 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
575 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
580 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment