| 
														
															@@ -6,7 +6,7 @@ import ( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	"math" 
														 | 
														
														 | 
														
															 	"math" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 ) 
														 | 
														
														 | 
														
															 ) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-const TradingRange = .01 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+const TradingRange = .02 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 func NewOrder( 
														 | 
														
														 | 
														
															 func NewOrder( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	m sentio.Market, 
														 | 
														
														 | 
														
															 	m sentio.Market, 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -36,14 +36,14 @@ func NewOrder( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	opts.StopLoss = sentio.ToFixed(rm.StopLoss(opts.Symbol, bid), 2) 
														 | 
														
														 | 
														
															 	opts.StopLoss = sentio.ToFixed(rm.StopLoss(opts.Symbol, bid), 2) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	// Prevent orders those have too small expected profit 
														 | 
														
														 | 
														
															 	// Prevent orders those have too small expected profit 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	if opts.TakeProfit < bid*(1+TradingRange) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	if opts.TakeProfit < bid+TradingRange { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		err = sentio.ErrLowTakeProfit 
														 | 
														
														 | 
														
															 		err = sentio.ErrLowTakeProfit 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		return 
														 | 
														
														 | 
														
															 		return 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	} 
														 | 
														
														 | 
														
															 	} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	// Prevent cases when order will be closed ASAP they were opened. 
														 | 
														
														 | 
														
															 	// Prevent cases when order will be closed ASAP they were opened. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	// Also, Alpaca requires at least 0.01 gap against base_price 
														 | 
														
														 | 
														
															 	// Also, Alpaca requires at least 0.01 gap against base_price 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	if opts.StopLoss > bid*(1-TradingRange) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	if opts.StopLoss > bid-TradingRange { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		err = sentio.ErrHighStoploss 
														 | 
														
														 | 
														
															 		err = sentio.ErrHighStoploss 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		return 
														 | 
														
														 | 
														
															 		return 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	} 
														 | 
														
														 | 
														
															 	} 
														 |