Stop Trading after profit
Author: EMan99
Creation Date: 11/1/2008 10:08 PM
profile picture

EMan99

#1
Is there a script that cancels the rest of the days trades after you exit your first postition of the day?

Also is there a way to enter profit and stops in dollars insted of %?

"else
BuyAtStop(bar + 1, Close[bar]+ 0.10)" ?

I am building an interday stratagy. onece I hit my profit I want to stop trading for the rest of the day.

I would search but the search is down.....

Thanks,
Eman99
profile picture

Cone

#2
QUOTE:
Is there a script that cancels the rest of the days trades after you exit your first postition of the day?
Be more specific. Cancels what trades? For other symbols in a Portfolio Simulation (MSB)?

QUOTE:
Also is there a way to enter profit and stops in dollars insted of %?
Of course, but it doesn't really make sense to have a point-based general rule for profits in the Wizard for stocks - unless you're targeting a specific instrument. In this case, you can program it yourself.

QUOTE:
I hit my profit I want to stop trading for the rest of the day.
That's probably not a good strategy, but in Version 5 position sizes and therefore dollar profit are not available at the script level. However, you can hard code a sizing method to determine the sizes of the Positions that you're taking and therefore can calculate the dollar profit.

At any rate, your requirements are too vague to even give you an example.
profile picture

EMan99

#3
Yes I am trading one stock.

I want to make one trade a day with one stock.

I want to buy at a price and sell at another price. "Sounds simple"

I don't care what any of the indicators are doing. I trade on price, support and resistance.

Its basically a "fade the gap" strategy but I can only play the long end not the short.

If today’s open is below yesterdays close then I buy at a few ticks above the open so I catch it on the upswing.

Once it hits my target profit say $1.00. I want to end my trading for the day or sell on the last bar of the day.

What I have coded, I can enter the trade at the open and sell at my target, but then the program enters another trade.

Thanks for your help.
profile picture

Cone

#4
QUOTE:
I don't care what any of the indicators are doing.
Nobody says that you must use indicators!

As you'll see here, the meat of the strategy is only a few lines of code, but there's some "fact finding" to do at the beginning - finding the tick value, the start of the second day, and synchronizing the daily closes. This extra complexity is one of the reason why the Wizard isn't really made for intraday strategies.

I assume 1 Position only -
CODE:
Please log in to see this code.

profile picture

EMan99

#5
Thanks I can see something simple is complicated I was tinkering with the scales but with out much luck.

I also found this example.

CODE:
Please log in to see this code.


I assume you can trade above and below your trend lines?

profile picture

Eugene

#6
QUOTE:
I assume you can trade above and below your trend lines?

Yes, you can.
profile picture

EMan99

#7
I added a stop loss. That sell at the end of the day is ugly..

Problem: code still enters a buy on a gap up, Open is higher than yesterdays close.

I tried to change it to "else if(Close(Bar - 1) > Open(Bar + 0)), it didn't like it, lots of red all over the screen...

What line of code keeps it from entering another trade on the same day? I may want to enter on the same the same day if it crosses back above the Open + ticks....

Thanks


CODE:
Please log in to see this code.
profile picture

Cone

#8
I just made a comment near the bottom of the code you posted. Unless you really know what you're doing, you should always pass bar + 1 to AtLimit, AtStop, and AtMarket trading signals. Always.
profile picture

EMan99

#9
Ok thanks,

What part of the code is telling it not to enter another trade on the same day? Is it

else if( todayOpen < Close[bar] && dayOfLastTrade != Date[bar].Day )

I think the perfect setup would be if SellAtStop is triggered then re-enter the Open + ticks trade BuyAtStop, if the SellAtLimit is triggered then end trading for the rest of the day. If you can explain what part is controling the do not enter another trade, I will take a crack at trying to re code the exit rules.