Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Purpose of code
Collapse
X
-
Purpose of code
In the process of developing a strategy, I created the code and then I paid a professional to clean it up. When I got it back, he had added several element that I am trying to understand the purpose. His code is well beyond my capability. If I can gain that understanding, I believe that I can complete the debugging. I have attached the <.cs> and my questions are, what has been accomplished by adding Lines 82-88 <OnOrderUpDate> as a prelude to Lines 152 to 167, and what is the purpose of these lines. What has been accomplished with Lines 141 and 148. These lines are identical except one is for Long and one is for Short.Tags: None
-
Hello galsermil,
The lines you mentioned are used to work with the order objects that are being used.
The lines you think are identical are two separate lines of code inside two separate conditions. The conditions show the name of the order that they are looking for.
These type of questions would be best to review with the person that you had worked with so they can explain their specific reasons of why those were added vs what you had originally supplied to them. Without knowing what you originally tried to do it would be hard to say why they added that code aside from it was needed to make it work how you requested.
If you want to learn more about working with order objects you can see the following sample script: https://ninjatrader.com/support/help...and_onexec.htm
-
Jesse,
For various reasons, I cannot depend on explanation from the so called professional so let me rephase part of my previous enquiry. In the code of lines 137-143 he is setting a profit target for Trade #2 and since that Exit will also close all entries attached to the strategy, why is it necessary to set a second profit target for Trade#1,
Comment
-
Hello galsermil,
Unfortunately I don't know what the intention was for the given code, you would need to review that with the developer to get the specific reason that was added.
The lines 137-143 are looking for a specific execution to execute the logic within that condition:
The executions name is Buy #2, the logic inside that condition is what they used.Code:else if (e.Name=="Buy #2")
Calling an exit method again will update an existing order, its possible they meant to update the order.
If the script is not working as expected you would have to revisit this with the developer. If the script is otherwise working as you asked for it to work then that is part of the logic necessary for what you had discussed with the developer.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
62 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
134 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
50 views
0 likes
|
Last Post
|

Comment