Manual TP and SL

Back to topics list To post a new topic, please log in or register
avatar
15
lovromirnik 2015.02.18 22:20
 

Hello fellow traders,

I have here a drawing that I've made for myself to more easily understand how I am to create manual coded Take Profits and Stop Losses.

Graphical RepresentationThe green X's represent an open order and is called a Point from now on.

I have no problem with the actual coding. I find it really easy.
But I would love to know if I am thinking about this right.

So, in the first scenario we open a Buy position at Point one with only Take Profit set at 10 Pips. When there is 10 Pips of difference between the current Bid Price and the Price we opened the trade at this should tick.

if (Bid >= (OrderOpenPrice + TakeProfit)
	{
		//Close with Profit (Of course at Bid)
	}

In the second one we open another Buy position at Point two with only Stop Loss set at 10 Pips. When the difference between the current Ask price and the price we opened the trade at is over 10 Pips this one should tick.

if (Ask <= (OrderOpenPrice - StopLoss)
	{
		//Close with Loss (Of course at Bid)
	}

Is this okay?
Thanks a lot,
Lovro Mirnik

avatar
15
lovromirnik 2015.02.19 21:02 #
 
I've figured it out, there is no need to look at the Ask when using Stop Loss, because at the end of the day you're closing it at Bid. There for I rather now set it to look at the Bid price and know exactly at what price and time to close.
avatar
13006
WHRoeder 2015.02.19 21:26 #
 
lovromirnik:  you're closing it at Bid.
Only for buy orders.

avatar
2017
gooly 2015.02.19 22:34 #
 
lovromirnik:
I've figured it out, there is no need to look at the Ask when using Stop Loss, because at the end of the day you're closing it at Bid. There for I rather now set it to look at the Bid price and know exactly at what price and time to close.

On the chart you see only bid prices (op, hi, lo, cl,..).

You enter a buy at ask and exit a buy at bid and you enter a sell at bid and exit a bid at ask.

It is pretty simple you'll always get the worse price of both.

Back to topics list  

To add comments, please log in or register