Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

How To Preserve Copy Paste Scripts format Into Ninjatrader Forum Efficiently?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How To Preserve Copy Paste Scripts format Into Ninjatrader Forum Efficiently?

    I've always wondered of a way to easily and quickly copy paste scripts into Ninjatrader forum and preserve the code format.
    As of now Ninjatrader forum or the tags pairs can't restitute the original format and the code can be difficult to read with all the parenthesis and lines left aliened.
    There is the other option to use an online or text editor C# beautifier but sometimes they adulterate the script and we get compile errors in the Ninjatrader Editor we must spend extra time figuring out how to solve before using the code, or and or they use the Java curly brackets style with all the leading brackets on the same lines of the initial snippets line, which we need to carriage return to get it as it original was (sometimes for a lot of them).

    I found a workaround by chance today.
    By pasting a script into a PHP tags pair in the Ninjatrader forum.
    Then performing manual reformatting into the PHP tags.
    Then by copying the manually formatted script from the PHP tags, and pasting into Sublime text editor.
    Then By hitting Ctrl+H to find and replace.
    I found out that the "whitespaces" from the manually formatted script showed this character hidden <0xa0> .

    Can this character be added by default to the Ninjatrader forum editor when pasting to solve the previous problems?

    Click image for larger version

Name:	0xa0.png
Views:	116
Size:	1.33 MB
ID:	1192200

    Else (which is ok timewise but would be better to add 0xa0 to the editor) we have to find and replace all whitespaces with <0xa0> each time to get the same result. Thanks!

    #2
    HI Paul, thanks for posting. It is an unfortunate part of the forum software we use. I can open up a ticket with them to see if they can fix this. I like to use pastebin.com to share code snippets:
    https://pastebin.com/ (publicly available)

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hello Chris all right thanks for the reply. Thanks for the pastebin too (I used pastecode.io that enables folding, but we never know if the code will remain with exterior services).
      Yes for a ticket please, so they are aware of the issues and convenient fix of the <0xa0> character.
      It wouldn't involve much just some function to convert the clipboard whitespaces to the <0xa0> character (within the PHP and CODE tags).
      Meanwhile the Ctrl+H find and replace all should do as it takes a few seconds to perform (but it involves having Sublime Text open every times).

      I've made a short demo (at the 2:00 min the Ctrl+H is showed, prior is the issue).


      Many thanks!

      Comment


        #4
        Hi Paul, I put in a request with our IT team who will either reach out to the forum software company or do something on their end to fix it. I'll let you know what I find out.

        Kind regards,
        -ChrisL
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Many thanks again Chris!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by geddyisodin, Today, 05:20 AM
          0 responses
          3 views
          0 likes
          Last Post geddyisodin  
          Started by JonesJoker, 04-22-2024, 12:23 PM
          6 responses
          33 views
          0 likes
          Last Post JonesJoker  
          Started by GussJ, 03-04-2020, 03:11 PM
          12 responses
          3,239 views
          0 likes
          Last Post Leafcutter  
          Started by AveryFlynn, Today, 04:57 AM
          0 responses
          6 views
          0 likes
          Last Post AveryFlynn  
          Started by RubenCazorla, 08-30-2022, 06:36 AM
          3 responses
          79 views
          0 likes
          Last Post PaulMohn  
          Working...
          X