Custom Indicators - Replacing multi line code ( for Ninjatrader)

144 views
Skip to first unread message

OldGreyWT

unread,
Mar 22, 2021, 1:32:28 PM3/22/21
to Adaptrade Builder
Hi everyone,

I can see that there are two options if you wish to use a custom indicator but can't write it in a single line code statement. 
1. Rewrite the indicator so that it is one line,
2. Rewrite the end code 

It is the second option that I am not clear about. The data part is fine and I can get the custom indicator return values into the data file. 

The question is, what goes into the section where the single line of code should be?
a) Nothing
b) Some form of pseudo code
c) A single line indicator code statement, acceptable to Ninjatrader, but one that produces a false return value.

I am assuming that for Option 3, the Adaptrade Builder's GP is only using the return value to create the strategy and not the C# code in Ninja. 

Any help, greatly appreciated
Many thanks

     

Mike Bryant

unread,
Mar 22, 2021, 1:44:51 PM3/22/21
to adaptrad...@googlegroups.com

The option I mention about modifying the strategy code after building is simply a catch-all solution. I’m just saying you have access to the code, so you can make any changes you want to make it work for you, but how you do that is entirely up to you. Using custom indicators requires some programming, and the solution will depend on what form your custom indicators are in.

 

Builder is designed so that the function statement you enter on the Data File Format window is a substitute for the values you added to the price data file for the indicator. In other words, it’s assumed that whenever that code is executed, it returns the indicator values shown in the file. If you don’t have a function to call to do that, you may have to get creative. Generally speaking, the best solution is usually to “rewrite” your indicator to return the values you need. Oftentimes, “rewriting” means wrapping the existing code in an additional function call that returns what you need for use in Builder.

 

Mike Bryant

Adaptrade Software

Tony Holland

unread,
Mar 22, 2021, 2:02:18 PM3/22/21
to adaptrad...@googlegroups.com
this might not be the most efficient way to do it, but I put in a word that will let me know where the code should go such as "putcodehere"
after I copy the code to tradestation and then edit the code and add in the code to replace "addcodehere"

Tony

--
You received this message because you are subscribed to the Google Groups "Adaptrade Builder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adaptrade-buil...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adaptrade-builder/0bcb9118-3caf-457a-99cd-e39247097587n%40googlegroups.com.


--
Tony Holland

Malcolm Blazey

unread,
Mar 22, 2021, 2:33:42 PM3/22/21
to adaptrad...@googlegroups.com
Thanks very much. I had completely forgotten about the idea of calling a function (method?). I am not a real programmer, although I started in 1968, so terminology is a bit vague on this side. I never had these problems with punched cards. Thanks also for the placeholder tip (Tony). 

Cheers
Malcolm 
 

You received this message because you are subscribed to a topic in the Google Groups "Adaptrade Builder" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adaptrade-builder/f8r6LZJacG4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adaptrade-buil...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adaptrade-builder/CA%2Bae_2FCAWLovWcxTQ7PV9Y6mKA-05Xp3VdLoLn%3DTJE7Lx-iew%40mail.gmail.com.

Tony Holland

unread,
Mar 22, 2021, 11:05:28 PM3/22/21
to adaptrad...@googlegroups.com
Happy to help Malcom -  It is a clunky way to do it and I am not always successful in replacing the correct code and getting it to verify.
Luckily Adaptatrade has most of the indicators built in.  
Tony 



--
Tony Holland
Reply all
Reply to author
Forward
0 new messages