LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default Generating Buy/Sell signals accordingly...

babapusy wrote:

Hello,
I need solution to two problems:

First,

sell 9
hold_sell
hold_sell
hold_sell
hold_sell
sell 8
hold_sell
hold_sell
hold_sell
take_profit 7

to calculate 9-7=2, and to ignore the second sell signal(fake signal,
there can be many of them in between).


That would scare the crap out of me. Something in the system is generating
fake buy/sell signals? What happens if those fake signals get acted upon by
someone who doesn't know they're fake?

As for the actual problem:

Sub buySellMath()
Dim buy As Boolean, sell As Boolean
c = ActiveCell.Column
For r = ActiveCell.Row To ActiveCell.End(xlDown).Row
l = Split(Cells(r, c).Value)
Select Case l(0)
Case "buy"
If Not (buy Or sell) Then
buy = True
initialvalue = l(1)
End If
Case "sell"
If Not (buy Or sell) Then
sell = True
initialvalue = l(1)
End If
Case "take_profit"
If buy Or sell Then
profitValue = initialvalue - l(1)
buy = False
sell = False
End If
End Select
Next
End Sub

Second,

Depending on the generated BUY signal for example, to generate STOP_LOSS
or TAKE_PROFIT signal in a given condition. For example to generate BUY
signal at price 10 pips above the Upper Bollinger Band and depending on
the generated buy signal to generate, let's say, STOP_LOSS if the
difference between the last value and the BUY is -10 pips, or
TAKE_PROFIT if the difference between the last value and the BUY signal
is +10 pips.
To be more clear to you what I mean, is if the formulated condition
generates BUY in B1 from A1, then to look for values
A2-A1,A3-A1,A4-A1,A5-A1 etc until it meets the condition -10 or +10
pips(to generate STOP_LOSS or TAKE_PROFIT accordingly) and to ignore the
in between BUY(fake) signals

I would be very thankful if someone wants to help me out solve this
problem. I have tried many combinations without success.




--
Booze! Not noose. That's a whole different party.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sell to reinvest Purfleet Excel Discussion (Misc queries) 1 June 17th 09 06:51 PM
Available to sell Hugues Excel Discussion (Misc queries) 1 October 31st 08 08:17 PM
Can i sell my vb program JustLearning Excel Programming 5 April 15th 07 04:55 PM
Import four analogue signals into computer howard Excel Discussion (Misc queries) 1 May 5th 06 03:27 PM
Looking for VB code to test for "RING" , "BUSY" disconnects or other signals BruceJ[_2_] Excel Programming 3 November 20th 03 01:55 AM


All times are GMT +1. The time now is 12:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"