| Coding Forum Collaborate, receive help, or discuss coding related issues. |
![]() | | Tweet | |
| | #1 | ||
![]() | Does anyone know where I can find some code to do this: (in easy language) a position on limit order, initial stop loss, 3 different targets, trigger of "stop loss change" to "break-even", with or without factor setting, at hit of a target, option to set the triggered "stop loss change" to be a "trailing stop loss". thanks! | ||
| |
|
| | #2 | ||
![]() | Re: Position Management Code for TS Quote:
if you write out your thoughts one line at a time... (instead of a blurb) you might be able to see your code hidden in there.
__________________ Only an idiot would reply to a stupid post | ||
| |
|
| | #3 | ||
![]() | ask user for position variable, place position as limit order, ask user for stop loss, set initial stop loss, ask user for up to 3 different targets, ask user for each target if there is a need to trigger a stoploss action, if trigger needed move stop loss to breakeven with the option of adjusting factor variable, or if trigger needed change stoploss to trailing stoploss with the option of adjusting factor variable. i tried... anyone????? | ||
| |
|
| | #4 | ||
![]() | Re: Position Management Code for TS // START Trading Strategy Study EasyLanguage Code [IntrabarOrderGeneration = false] inputs: ShareOrPosition( 1 ), { pass in 1 for per share basis, 2 for position basis } ProfitTargetAmt( 5 ), { pass in 0 if you don't want a profit target } StopLossAmt( 1 ), { pass in 0 if you don't want a stop loss } BreakevenFloorAmt( 0 ), { pass in 0 if you don't want a breakeven stop } DollarTrailingAmt( 0 ), { pass in 0 if you don't want a dollar trailing stop } PctTrailingFloorAmt( 0 ), { pass in 0 here and/or in next input if you don't want a percent trailing stop } PctTrailingPct( 0 ), { pass in 0 here and/or in previous input if you don't want a percent trailing stop; else pass in XX for XX percent } ExitOnClose( false ) ; { pass in true if you want to exit the position at the close of the day, else pass in false. CAUTION: We recommend that you set this to TRUE only for back-testing, if at all; in automated execution, the exit order will NOT be filled at the close of the day; instead, the order can be sent into the extended session as a limit order. } if ShareOrPosition = 1 then SetStopShare else SetStopPosition ; if ProfitTargetAmt > 0 then SetProfitTarget( ProfitTargetAmt ) ; if StopLossAmt > 0 then SetStopLoss( StopLossAmt ) ; if BreakevenFloorAmt > 0 then SetBreakeven( BreakevenFloorAmt ) ; if DollarTrailingAmt > 0 then SetDollarTrailing( DollarTrailingAmt ) ; if PctTrailingFloorAmt > 0 and PctTrailingPct > 0 then SetPercentTrailing( PctTrailingFloorAmt, PctTrailingPct ) ; if ExitOnClose = true then SetExitOnClose ; // END Trading Strategy EasyLanguage Code | ||
| |
|
| | #5 | ||
![]() | Re: Position Management Code for TS a) Recompile your code and review the error messages. See, if you can determine the error on your own and if not then post the error messages on the forum and ask for help. b) I had a difficult time following your sequence of operation because it appears that you are trying to specify entry & exit conditions but the code you provided only exits the market, once the conditions in the code are satisfied and marketposition <> 0. c) Perhaps further clarifying your objective will be helpful as Tams suggested, however you might want to print-out a simple chart; attach some notes ie enter on this trigger(s), qty x limit order at this price level; stop(s) at this price level(s); profit target(s) this level(s). Scan the document and post. I doubt anyone will write the code for you but perhaps someone will share some code; help you edit your work; or provide a link. Based on my understanding of what you outlined .... this code will not meet your objective. RANGER Last edited by Ranger; 07-18-2010 at 10:35 AM. Reason: error in posting | ||
| |
|
| | #6 | ||
![]() | Re: Position Management Code for TS Quote:
you will be up and running faster (ie make real money).
__________________ Only an idiot would reply to a stupid post | ||
| |
|
| | #7 | ||
![]() | Re: Position Management Code for TS Quote:
__________________ Only an idiot would reply to a stupid post | ||
| |
|
| The Following User Says Thank You to Tams For This Useful Post: | ||
aaa (07-24-2010) | ||
| | #8 | ||
![]() | Re: Position Management Code for TS Thank you for taking the time to respond with some thought. The sample code above does suffice my needs, as my initial thoughts were not exact. Anyhow, I have it working at the moment with the help of my broker as I really have no time to fiddle with code... Apparently they value my business. Best Regards, BB | ||
| |
|
![]() |
| Thread Tools | |
| Display Modes | Help Others By Rating This Thread |
| |