Jump to content

NaxFM

Members+
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. Hello everyone. I really need help understanding how some of the script function really work, because it seems that every time i click the hotkey, the same exact script does different things. In particular I'm having troubles understanding why Round2 seems to not work the way it should. I have this simple script, which adds 50 shares to an already existing position and moves the stop loss to the new average price. I would like to round the stop loss price to avoid setting the stop loss to something like 206.36344534... dollars. However it seems that Round2 does not round the price to the two decimals, but in reality adds to it. It is weird but i can't explain it. the script is this one: if(pos >0){ CXL ALLSYMB; ROUTE=LIMIT; Price=Ask+0.05; Share=50; TIF=DAY+; BUY=Send; $mystop = avgcost; $mystopround = $mystop; $mystopround = Round2; TriggerOrder=RT:STOP STOPTYPE:MARKET PX:$mystop ACT:SELL STOPPRICE:$mystop QTY:Pos TIF:DAY+; } When executed, the variables mystop and mystopround have completely different values. Mystop has the correct value but it has way more decimal places than needed, while mystopround is 30 cents above mystop. I do not execute other scripts, so these variables get set by this script only. I've read the documentation and I can't find what i'm doing wrong. Thank you
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.