Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

System incorporating scaling-in Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
miles3w
Posted : Monday, May 10, 2010 7:28:42 PM
Registered User
Joined: 3/29/2007
Posts: 11
I am trying to plan a scale in strategy for the following:
Setup: Currently not in a position
    Price > 200SMA
    RSI(2) > 25
    RSI(1) < 25
    RSI < 25
    A    Buy on Close
Scale In:
    B    If still in the trade and
        Close < entry price ( A )
        Buy 2x on Close
    C    If still in the trade and
        Close < price ( B )
        Buy 3x on Close
    D    If still in the trade and
        Close < price ( C )
        Buy 4x on Close
Exit:
    RSI > 70
    Exit all

I have the script to enter based on the Setup. I don't know how to 'remember' the purchase price (close of A, B or C) so I can reference it for the Scale in Strategy. How would I program this?

The Scale-In would stop if the exit is reached. E.g. If two buys happen (A and B), then RSI > 70, C and D would not execute.

While in a trade, no new A positions would be executed.

Thanks for your help with this,

- Miles
miles3w
Posted : Thursday, May 20, 2010 12:11:57 PM
Registered User
Joined: 3/29/2007
Posts: 11
Anybody have even a hint for what to do?Thanks,- Miles
jas0501
Posted : Thursday, May 20, 2010 7:26:59 PM
Registered User
Joined: 12/31/2005
Posts: 2,499

You can't backscan this but can do it in code. Something like

'# StartingEquity = userinput.single = 100000
const xPeices as integer = 10

static InTrade as boolean
static buyFactor as integer
static equity as single
static entryPrice as single
static shares as integer
static totalShares as integer

if isfirstbar then
   equity = StartingEquity
   buyFactor = 1
   inTrade = false
   totalShares = 0
end if
if enterOnOpen then
 end if

if inTrade = false then
     If timeToEnter = true then
         shares = (equity/xPieces)/price.close 
         totalshares += buyFactor * shares
         entryPrice = price.close
         equity -= entryPrice * buyfactor * shares
         buyFactor += 1
    end if
else   ' must be in trade
      if timeToExit = true the
         equity += totalShares * price.close
         totalShares = 0
         buyFactor = 1
         intrade = false      
      else if price.close < entryPrice  andalso _
         buyFactor < 4 then
             entryprice = price.close
             equity -= entryPrice * buyFactor * shares
            totalShares += buyFactor * shares
            buyFactor += 1
      end if
end if

plot = equity + totalshares * price.close 

jas0501
Posted : Thursday, May 20, 2010 7:29:00 PM
Registered User
Joined: 12/31/2005
Posts: 2,499

delete lines
if enterOnOpen then
 end if

Note the code is uncompiled and untested.

Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.