code, I do not understand.

Created at 14 Aug 2014, 20:13
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
AV

avrudoi

Joined 07.08.2014

code, I do not understand.
14 Aug 2014, 20:13


help decipher the code I do not understand this entry.

//double targetPrice = TradeType == TradeType.Buy ? Symbol.Ask - Target * Symbol.PipSize : Symbol.Bid + Target * Symbol.PipSize;

Again, I can not understand. In the past TOPIC THAT I asked questions REGARDING SIMBLE.ASK. FOR ME it is not clear if my PURCHASE PRICE, QUANTITY IS WHY BUY FROM dollorov stock prices these two parameters.

IN THIS CASE

Symbol.Ask - Target * Symbol.PipSize;


@avrudoi
Replies

Spotware
15 Aug 2014, 09:35

It is not clear what you mean. Please try to clarify your question.


@Spotware

avrudoi
16 Aug 2014, 15:37

Here is an example on your forum site 
/forum/calgo-reference-samples/2231 
function OnStart using code 
protected override void OnStart () 
         {
             double targetPrice = TradeType == TradeType.Buy 
                                      ? Symbol.Ask - Target * Symbol.PipSize 
                                      : Symbol.Bid + Target * Symbol.PipSize; 
 
             PlaceLimitOrder (TradeType, Symbol, Volume, targetPrice, MyLabel, 
                              StopLossPips, TakeProfitPips); 
         } 
  how to understand this record 
Symbol.Ask - Target * Symbol.PipSitse; 

in this line of the purchase price of the dollar amount of his multiplicationt.e. dollarov and minus the question of why the ask price -  is a price for that Symbol.Ask 10-20, .... dollorov? or 1 dollorov.


@avrudoi

pennyfx
01 Sep 2014, 19:10

That line of code can also be expressed like this.

double targetPrice = 0.0;

if(TradeType == TradeType.Buy){

// Take the current Ask (since we're buying) subtract the Target (probably for a better entry)
targetPrice =  Symbol.Ask - Target * Symbol.PipSize;

}else {

//  Take the current Bid(since we're selling) add the Target   
//  Target * Symbol.PipSize
//  Target is probably a number like 5.5, so multiplying it by PipSize turns it into  0.00055

targetPrice = Symbol.Bid + Target * Symbol.PipSize

}

 


@pennyfx